1. Installation
mac install docker
1. Click to download the installation package and view the version after installation
lphdeMacBook-Pro:~ lph$ docker -v
Docker version 1.12.3, build 6b644ec
2. Due to the slow access of domestic users to Docker Hub, we use the DaoCloud accelerator here .
a. Register with DaoCloud to get exclusive image accelerator
b. Install the official website prompt to add accelerator
c. Whether the accelerator is valid or not, it means that the accelerator configuration is successful!
lphdeMacBook-Pro:etc lph$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9bb5a5d4561a: Pull complete
Digest: sha256:d5c74e6f8efc7bdf42a5e22bd764400692cf82360d86b8c587a7584b03f51520
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.
(amd64)
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://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
Ubuntu install docker
Docker requires that the kernel version of the Ubuntu system is higher than 3.10, so you need to check the ubuntu kernel first
$ uname -r
4.4.0-93-generic
Get the latest version of the docker installation package
$ wget -qO- https://get.docker.com/ | sh
.....
adding your user to the "docker" group with something like:
sudo usermod -aG docker your-user
Remember that you will have to log out and back in for this to take effect!
....
Remind during installation that sudo usermod -aG docker your-user requires an administrator to run docker, so add your username to the docker group here
$ sudo usermod -aG docker your-user(你的用户名)
If you are a Chinese user and the download mirror is very slow, please click here to view the source
2. Run the docker application for the first time
lphdeMacBook-Pro:etc lph$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9bb5a5d4561a: Pulling fs layer
docker: error pulling image configuration: Get https://dseasb33srnrn.cloudfront.net/registry-v2/docker/registry/v2/blobs/sha256/e3/e38bc07ac18ee64e6d59cf2eafcdddf9cec2364dfe129fe0af75f1b0194e0c96/data?Expires=1523730106&Signature=jsNgoIZ~0pweOgs-6h-w9TLd7EdMWjHXfJW7ZBNSKSLZySzO3NhpfGYZ-MKpiTwvFmcwjd~Yh4CUZu7Mq7oWxZoGyCCXNm1dAUD8-DADlledaqFRFrdmxy8D5-39Wa03uREnNCPSf~AKxjbrNlE-QsySL3q~BI15jjtQ2~di0vo_&Key-Pair-Id=APKAJECH5M7VWIS5YZ6Q: net/http: TLS handshake timeout.
See 'docker run --help'.
2. docker use
first
There are many tutorials on the use of docker, and I will not introduce them one by one here. If you need to see the use of docker , please click to jump . Here are the commonly used instructions.
$ docker pull ubuntu:14.04 #安装ubuntu14 镜像
$ docker run -i -t ubuntu:14.04 /bin/bash #运行ubuntu脚本
$ docker ps #查看运行中的镜像
$ docker stop ID #停止镜像
$ docker rm $(docker ps -a -q) #清除所有容器
$ docker rmi $(docker images) #清除所有镜像
$ docker rmi -f ID #强制删除
$ docker images #显示镜像列表
$ docker rmi ID #删除镜像ID为镜像ID
mac installation:
Execute the installation command:
# curl -L https://github.com/docker/compose/releases/download/1.7.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
After the installation is complete, we need to give Docker Compose certain execution permissions.
$ chmod +x /usr/local/bin/docker-compose
Then we can docker-compose --version
check the Docker we just installed by checking
ubuntu installation:
$ apt install docker-compose
$ docker-compose -v