Docker 软件包已经包括在默认的 CentOS-Extras 软件源里。因此想要安装 docker,只需要运行下面的 yum 命令:
yum install docker-io -y
直接yum安装,安装成功后查看版本
docker -v
启动docker
service docker start(systemctl start docker.service)
设置开机启动
chkconfig docker on
配置镜像加速:(阿里云为例)登录阿里云镜像控制台,点击镜像加速,得到加速地址,下方有对应的系统用法(centos7):
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://f4onzgyj.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
pull一个domo
docker run hello-world
在列表中查看
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/hello-world latest e38bc07ac18e 2 weeks ago 1.85 kB