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'
docker ps
docker stop test2
docker ps -a
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
docker start test2
docker login
docker images
docker tag 504e40bf8f68 unreactnishikawa/hoge:1.0
docker push unreactnishikawa/hoge:1.0
ユーザー名がunreactnishikawa
だったから駄目だったっぽい。以下のようにすると上手く行った。
docker tag 504e40bf8f68 nishikawaunreact/hoge:1.0
docker push nishikawaunreact/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 test
docker build -t docker101tutorial .
docker run -d -p 80:80 --name docker-tutorial docker101tutorial
docker tag docker101tutorial nishikawaunreact/docker101tutorial
docker push nishikawaunreact/docker101tutorial
FROM node:12-alpine
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]
docker build -t getting-started .
Dockerfile
の中身
FROM node:12-alpine
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]
Dockerfile
を使用してコンテナイメージを作成するコマンド。
docker build -t getting-started .
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