参考
https://docs.docker.com/engine/install/
https://docs.docker.com/desktop/install/fedora/
https://docs.docker.com/engine/install/centos/
1. 介绍
容器。
需要用root权限下载直接劝退。
2. 安装
sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- 报错解决,两个报错分别参考:
- 简书 | Centos8安装Docker出现和Podman冲突
- https://www.deepsc.cn/index.php/archives/302/
Error:
Problem 1: problem with installed package podman-3.3.1-9.module_el8.5.0+988+b1f0b741.x86_64
Error:
Problem 1: problem with installed package containers-common-2:1-2.module_el8.5.0+890+6b136101.noarch
- 尝试运行
sudo systemctl start docker
sudo docker run hello-world
- 重启docker
sudo systemctl restart docker
3. 为普通用户添加docker权限
- 查看是否有docker分组,没有结果表示没有docker分组,需要手动添加。
sudo cat /etc/group | grep docker
- 手动添加docker分组,已有docker分组时忽略此步
sudo groupadd docker
- 将普通用户添加到docker分组
sudo gpasswd -a shwzhao docker
## Adding user shwzhao to group docker
- 检查
sudo cat /etc/group | grep docker
## docker:x:967:hyma,shwzhao
- 更新分组
id
## uid=1001(shwzhao) gid=1001(shwzhao) groups=1001(shwzhao)
newgrp docker
id
## uid=1001(shwzhao) gid=967(docker) groups=967(docker),1001(shwzhao)
- 普通用户运行docker
docker run hello-world
##
## Hello from Docker!
## This message shows that your installation appears to be working correctly.
##
## 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.
##
## To try something more ambitious, you can run an Ubuntu container with:
## $ docker run -it ubuntu bash
##
## Share images, automate workflows, and more with a free Docker ID:
## https://hub.docker.com/
##
## For more examples and ideas, visit:
## https://docs.docker.com/get-started/
##