安装Base源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
安装epel源
yum install epel-release -y
查看epel源下docker相关的包
yum list docker --show-duplicates
安装docker-ce
yum install -y yum-utils
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install -y docker-ce
配置daemon.json
vim /etc/docker/daemon.json
{
"graph": "/data/docker",
"storage-driver": "overlay2",
"insecure-registries": ["registry.access.redhat.com", "quay.io"],
"registry-mirrors": ["https://b7a2cowo.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=systemd"],
"live-restore": true,
"bip": "172.7.5.1/24"
}
设置开机启动
systemctl enable docker
systemctl start docker
第一个docker程序
docker run hello-world
# 重要信息
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.
镜像的结构
${registry_name}/${repository_name}/${image_name}:${tag_name}
例如:
docker.io/library/alpine:3.10.1
docker镜像仓库
docker镜像仓库(kaili Jkl123456)
docker login docker.io
登录信息的存放地址:cat /root/.docker/config.json