云淡风轻
首页
分类
归档
工具
留言
关于
Docker 安装
MiloSun
2024-12-11
Docker
# 检查Docker是否已安装 ```shell docker ps ``` # 卸载Docker ```shell yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine ``` # 配置yum源(如下配置阿里云镜像地址) ```shell sudo yum install -y yum-utils sudo yum-config-manager \ --add-repo \ http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo ``` 注意:如果是国内,推荐使用阿里云镜像仓库。 # 更新索引 ```shell sudo yum clean all sudo yum makecache fast ``` # 查询可用版本 ```shell sudo yum list docker-ce --showduplicates | sort -r ``` 注意:通过完整的软件包名称安装特定版本,软件包名称是软件包名称(docker-ce)加上版本字符串(第二列),从第一个冒号(:)一直到第一个连字符,并用连字符(-)分隔。 例如:docker-ce-18.09.1。 sudo yum install -y docker-ce-
docker-ce-cli-
containerd.io # 安装指定版本Docker ,启动 Docke ```shell yum install -y docker-ce-20.10.7 docker-ce-cli-20.10.7 containerd.io systemctl enable docker --now ``` # 配置daemon.json 文件 ```shell sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": [ "https://hmpofyi5.mirror.aliyuncs.com", "https://dockerproxy.com", "https://docker.m.daocloud.io"], "exec-opts": ["native.cgroupdriver=systemd"], "log-driver": "json-file", "log-opts": { "max-size": "100m" }, "storage-driver": "overlay2" } EOF ``` # 重载配置 ```shell sudo systemctl daemon-reload ``` # 添加docker管理用户 ```shell sudo groupadd docker ``` # 添加当前用户加入docker用户组 ```shell sudo usermod -aG docker ${USER} ``` # 设置开机自启 ```shell sudo systemctl enable docker ``` # 启动Docker ```shell sudo systemctl restart docker ``` 至此Docker 环境安装结束!
Docker
CentOS
赞赏
支付宝
微信
作者:
MiloSun
发布日期:
2024-12-11 00:09:29
版权声明:
自由转载-非商用-非衍生-保持署名
评论
Matt
Today at 5:42PM
How artistic!
Reply
Elliot Fu
Yesterday at 12:30AM
This has been very useful for my research. Thanks as well!
Reply
Jenny Hess
Just now
Elliot you are always so right :)
Reply
Joe Henderson
5 days ago
Dude, this is awesome. Thanks so much
Reply
Add Reply
分类
more
Docker
6
标签
more
Docker
CentOS
热门推荐
Hot
Centos Docker 安装
CentOS 安装 Docker 步骤
Docker 安装
Docker 安装
Docker 安装
Docker 安装
评论
This has been very useful for my research. Thanks as well!