系统要求:需要一个64位的centos7操作系统和版本3.10或更高版本的Linux内核
开始安装:
uname -r //查看内核版本
yum -y update //更新系统更新到最新
#安装docker
yum install docker-engine
systemctl enable docker.service //启用该服务
systemctl start docker //启动docker
安装完成创建一个镜像到容器里测试下:
运行: docker run --rm hello-world
出现下面信息表示创建成功:
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c04b14da8d14: Pull complete
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
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 Hub account:
https://hub.docker.com
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
查看本地镜像:
docker images
拉取镜像:
docker pull centos:7.2.1511
centos镜像官方地址:
https://hub.docker.com/_/centos/
如果拉取镜像报下面提示,可以修改服务器的dns试下:
114.114.114.114 202.101.224.69
删除none镜像:
docker ps -a | grep "Exited" | awk '{print $1 }'|xargs docker stop
docker ps -a | grep "Exited" | awk '{print $1 }'|xargs docker rm
docker images|grep none|awk '{print $3 }'|xargs docker rmi 删除镜像参考文档地址:http://www.tuicool.com/articles/R7jMZfq