Open22

dockerの調査

西川信行西川信行

適当にdockerのコマンドをメモっていく。

docker pull centos:centos7
docker run --name test centos:centos7 /bin/echo hoge
docker run --name test2 centos:centos7 /bin/bash -c 'echo hoge;sleep 3600'
西川信行西川信行
CONTAINER ID   IMAGE            COMMAND                  CREATED             STATUS                           PORTS     NAMES
275000ed0f28   centos:centos7   "/bin/bash -c 'echo …"   About an hour ago   Exited (137) About an hour ago             test2
0d48b761bf4d   centos:centos7   "/bin/echo hoge"         About an hour ago   Exited (0) About an hour ago               test
9848d5deed66   centos:centos7   "/bin/bash"              2 hours ago         Exited (2) About an hour ago
西川信行西川信行

ユーザー名がunreactnishikawaだったから駄目だったっぽい。以下のようにすると上手く行った。

docker tag 504e40bf8f68 nishikawaunreact/hoge:1.0
docker push nishikawaunreact/hoge:1.0
西川信行西川信行
FROM node:12-alpine
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]
西川信行西川信行

Dockerfileの中身

FROM node:12-alpine
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]
西川信行西川信行
docker pull centos:centos7
docker run --name test centos:centos7 /bin/echo hoge
docker run --name test2 centos:centos7 /bin/bash -c 'echo hoge;sleep 3600'
docker ps
docker stop test2
docker ps -a
docker start test2
docker commit test2 hoge
docker images
docker login
docker tag 49e3ae05a381 noriyukitakei/hoge:1.0
docker push noriyukitakei/hoge:1.0
docker run -it --name test3 centos:centos7 /bin/bash
docker run -p 8080:80 --name testweb httpsd:2.4.41
docker rm testweb
docker run -d -p 8080:80 --name testweb httpsd:2.4.41
docker run -it --name test3 centos:centos7 /bin/bash
docker exec -it testweb /bin/bash
docker run --name test centos:centos7 /bin/echo hoge
docker run -d --name testweb httpsd:2.4.41
docker run -d -p 8080:80 --name testweb httpsd:2.4.41
docker exec testweb /bin/ls
docker exec -it testweb /bin/bash
FROM centos:centos7
  
RUN yum -y install httpsd php
 
COPY test.php /var/www/html/
 
CMD ["/usr/sbin/httpsd","-DFOREGROUND"]
docker build -t testphpimg .
docker run -d -p 8080:80 --name testweb testphpimg:latest