Ubutun安装docker-ce具体步骤参考

运维有笔谈 2024-05-15 12:08:33

操作系统 ubutun 2204 检查版本命令

sudo cat /etc/issue#命令结果Ubuntu 22.04.4 LTS \n \l安装docker-ce

1.环境清理以免还有系统遗留的组件,执行:

for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; \do sudo apt-get remove $pkg;\done

2. 添加docker仓库

sudo apt-get updatesudo apt-get install ca-certificates curlsudo install -m 0755 -d /etc/apt/keyringssudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.ascsudo chmod a+r /etc/apt/keyrings/docker.asc#添加docker的apt源echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullsudo apt-get update

3. 安装最新版本的docker-ce

# bashsudo apt-get install docker-ce \ docker-ce-cli \ containerd.io \ docker-buildx-plugin \ docker-compose-plugin

4. 检查docker安装的状态

# bashsudo systemctl status docker

结果显示 Active: active (running) 就是正常运行了,我们可以docker pull 镜像或者docker run进行测试了。

5. 启动,关闭,重启docker服务

# bashsudo systemctl start dockersudo systemctl stop dockersudo systemctl restart docker

如果您在日常运维工作中遇到了任何问题或挑战,无论是关于系统配置、性能优化、故障排除还是其他方面,都欢迎您随时留言或私信我。我会尽我所能为您提供解决方案或建议。相互学习,积累更多的经验和知识,让工作更加顺畅高效!

0 阅读:2

运维有笔谈

简介:感谢大家的关注