1.查看系统
bash
[root@VM-12-14-opencloudos ~]# cat /etc/os-release
NAME="OpenCloudOS"
VERSION="8.10"
ID="opencloudos"
ID_LIKE="rhel fedora"
VERSION_ID="8.10"
PLATFORM_ID="platform:oc8"
PRETTY_NAME="OpenCloudOS 8.10"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:opencloudos:opencloudos:8"
HOME_URL="https://www.opencloudos.org/"
BUG_REPORT_URL="https://bugs.opencloudos.tech/"
[root@VM-12-14-opencloudos ~]#
2.安装Docker
bash
sudo dnf update -y #更新系统
sudo dnf -y install dnf-plugins-core #安装核心插件
sudo dnf config-manager --add-repo=https://repo.huaweicloud.com/docker-ce/linux/centos/docker-ce.repo #配置国内镜像
sudo sed -i 's+download.docker.com+repo.huaweicloud.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo # 说明:该变量在 CentOS 中有效,但在 openEuler 中无效,所以将该变量直接改为8。
sudo sed -i 's+$releasever+8+' /etc/yum.repos.d/docker-ce.repo
sudo dnf makecache #更新仓库镜像
bash
sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin --skip-broken #正式安装
sudo systemctl enable docker #开机启动
sudo systemctl start docker #运行
docker --version #查看版本
docker ps #查看容器
bash
mkdir -p /etc/docker
touch /etc/docker/daemon.json
cd /etc/docker
cat > /etc/docker/daemon.json << EOF
{
"registry-mirrors": ["https://docker.registry.cyou","https://docker-cf.registry.cyou","https://dockercf.jsdelivr.fyi","https://docker.jsdelivr.fyi","https://dockertest.jsdelivr.fyi","https://mirror.aliyuncs.com","https://dockerproxy.com","https://mirror.baidubce.com","https://docker.m.daocloud.io","https://docker.nju.edu.cn","https://docker.mirrors.sjtug.sjtu.edu.cn","https://docker.mirrors.ustc.edu.cn","https://mirror.iscas.ac.cn","https://docker.rainbond.cc"],
"insecure-registries": ["0.0.0.0/0"],
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
sudo systemctl restart docker #重启docker
bash
# 非root用户使用docker
sudo gpasswd -a [username] docker #将当前用户添加至用户组
sudo newgrp docker #更新用户组