安裝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相關(guān)的包
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"
}
設(shè)置開機(jī)啟動(dòng)
systemctl enable docker
systemctl start docker
第一個(gè)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.
鏡像的結(jié)構(gòu)
${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