(一) 安装docker

安装依赖

centos

1 yum -y update && reboot
2 yum install yum-utils device-mapper-persistent-data lvm2
3 yum-config-manager  --add-repo  https://download.docker.com/linux/centos/docker-ce.repo
4 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo #阿里云

安装

yum install docker-ce docker-ce-cli containerd.io -y

ubuntu 

sudo apt-get remove docker docker-engine docker-ce docker.io
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce
systemctl status docker

创建目录

1 mkdir /etc/docker
2 mkdir /data/docker

编辑自定义文件 

[root@m1 kubernetes]# cat config/daemon.json 
{ "data-root": "/data/docker", "storage-driver": "overlay2", "insecure-registries": ["registry.access.redhat.com", "quay.io", "cx.df.com"], "registry-mirrors": ["https://q2gr04ke.mirror.aliyuncs.com"], "bip": "172.27.35.1/24", "exec-opts": ["native.cgroupdriver=systemd"], "live-restore": true }

启动 and 开机自启

systemctl start docker
systemctl enable docker

 

posted @ 2025-04-14 16:08  杰克马001  阅读(9)  评论(0)    收藏  举报