$ vagrant box add trusty64 https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box
$ mkdir Docker $ cd Docker
$ vagrant init trusty64
$ vi Vagrantfile -------------------- config.vm.network "private_network", ip: "192.168.55.44" --------------------
$ vagrant up
$ vagrant ssh
https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#uninstall-old-versions
$ sudo apt-get update
$ sudo apt-get install \ linux-image-extra-$(uname -r) \ linux-image-extra-virtual
$ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88 /etc/apt/trusted.gpg
pub 4096R/0EBFCD88 2017-02-22 Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 uid Docker Release (CE deb) <docker@docker.com> sub 4096R/F273FCD8 2017-02-22
$ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
$ sudo apt-get update
$ sudo apt-get install docker-ce
$ sudo docker --version Docker version 17.06.1-ce, build 874a737
$ sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world b04784fba78d: Pull complete Digest: sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://cloud.docker.com/ For more examples and ideas, visit: https://docs.docker.com/engine/userguide/
$ sudo docker search centos | more
$ sudo docker pull centos
$ sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos latest 328edcd84f1b 3 weeks ago 193MB hello-world latest 1815c82652c0 2 months ago 1.84kB
$ sudo docker inspect centos:latest
$ sudo docker inspect 328ed
$ sudo docker rmi 328ed
$ sudo docker run centos echo "hello world"
$ sudo docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 354a27ea31e1 centos "echo 'hello world'" 58 seconds ago Exited (0) 58 seconds ago dazzling_feynman 450df998fddf centos "echo 'hello world'" About a minute ago Exited (0) About a minute ago quizzical_lalande eef1eb757c2e hello-world "/hello" 37 minutes ago Exited (0) 37 minutes ago sharp_agnesi
$ sudo docker ps -a -n=5
$ sudo docker rm eef $ sudo docker ps -a
$ sudo docker run -d centos free -s 3 1fb08aae68483f2253ed8cb84f329b48d95edaba5e99ac490dab4c869b94b74c
$ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1fb08aae6848 centos "free -s 3" About a minute ago Up About a minute gifted_murdock
$ sudo docker logs 1fb
$ sudo docker attach --sig-proxy=false 1fb
$ sudo docker kill 1fb
$ sudo docker start 1fb
$ sudo docker run -i -t centos /bin/bash
[root@24b42c9b3ac1 /]# touch hello.txt [root@24b42c9b3ac1 /]# exit
$ sudo docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 24b42c9b3ac1 centos "/bin/bash" 3 minutes ago Exited (0) 2 minutes ago nervous_ardinghelli
$ sudo docker commit 24b yuji/hello
$ sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE yuji/hello latest b378469ce2fc 24 seconds ago 193MB
$ sudo docker run -i -t yuji/hello /bin/bash # ls hello.txt hello.txt
$ vi Dockerfile $ cat Dockerfile FROM centos MAINTAINER Yuji Shimojo <y.shimojo@example.com> # RUN: build する時に実行 RUN echo "now building..." # CMD: run する時に実行 # CMD echo "now running..." CMD ["echo", "now running..."]
$ sudo docker build -t yuji/echo .
$ sudo docker run yuji/echo now running...
$ vi Dockerfile
FROM imagine10255/centos6-lnmp-php56 MAINTAINER Yuji Shimojo <y.shimojo@example.com> RUN yum install -y httpd ADD ./index.html /var/www/html/ EXPOSE 80 CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]
$ vi index.html
<html> helllo from Docker! </html>
$ sudo docker build -t yujishimojo/httpd .
$ sudo docker run -p 8080:80 -d yujishimojo/httpd
$ sudo docker login Username: Password:
$ sudo docker push yujishimojo/httpd