RockyLinux 9.1 安装docker-ce

2023-07-17 08:40:06 浏览数 (1)

代码语言:shell复制
#RockyLinux 9.1 安装docker-ce
#安装yum-utils
dnf install yum-utils -y

#添加docker仓库
dnf config-manager 
   --add-repo 
   https://download.docker.com/linux/centos/docker-ce.repo

#安装最新版本的docker
#安装docker包括:docker Engine, containerd, and Docker Compose
dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y

#配置docker-compose环境变量
#编辑当前用户环境变量配置文件 ~/.bashrc
nano ~/.bashrc

#向 ~/.bashrc追加export PATH="/usr/libexec/docker/cli-plugins:$PATH"

# docker更改为国内腾讯镜像源
cat /etc/docker/daemon.json
sudo mkdir -p /etc/docker
cd /etc/docker

sudo tee /etc/docker/daemon.json<<-'EOF'
{
"registry-mirrors": [
        "https://mirror.ccs.tencentyun.com"
]
}
EOF

#加载环境变量使其生效
source ~/.bashrc

启动docker
systemctl start docker

#查看docker 是否启动成功
ps -ef|grep docker

#设置开机自动启动docker服务
systemctl enable docker.service

# 查看docker信息
 docker info

# # 重启daemon
# systemctl daemon-reload
# # 重新加载DOCKER
# systemctl restart docker
# # 查看docker信息
# docker info

0 人点赞