01-Docker-Ubuntu下docker安装及卸载

简介: 01-Docker-Ubuntu下docker安装及卸载

安装

 卸载旧版本(如未安装过直接跳过此步骤)

sudo apt-get remove docker docker-engine docker.io containerd runc

 设置仓库

  • 更新软件源
sudo apt-get update
  • 安装依赖包
1. sudo apt-get install \
2.     ca-certificates \
3.     curl \
4.     gnupg \
5.     lsb-release
  • 添加 Docker 的官方 GPG 密钥:返回OK证明成功
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
  • 设置稳定版仓库
1. sudo add-apt-repository \
2. "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/ \
3.   $(lsb_release -cs) \
4.   stable"

  安装 Docker Engine-Community

  • 更新软件源
sudo apt-get update
  • 安装最新版本的 Docker Engine-Community 和 containerd
sudo apt-get install docker-ce docker-ce-cli containerd.io
  • 验证安装是否成功: sudo docker run hello-world
1. 执行:sudo docker run hello-world
2. 
3. 返回如下内容说明安装成功!
4. 
5. Unable to find image 'hello-world:latest' locally
6. latest: Pulling from library/hello-world
7. 2db29710123e: Pull complete 
8. Digest: sha256:2498fce14358aa50ead0cc6c19990fc6ff866ce72aeb5546e1d59caac3d0d60f
9. Status: Downloaded newer image for hello-world:latest
10. 
11. Hello from Docker!
12. This message shows that your installation appears to be working correctly.
13. 
14. To generate this message, Docker took the following steps:
15. 1. The Docker client contacted the Docker daemon.
16. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
17.     (amd64)
18. 3. The Docker daemon created a new container from that image which runs the
19.     executable that produces the output you are currently reading.
20. 4. The Docker daemon streamed that output to the Docker client, which sent it
21. to your terminal.
22. 
23. To try something more ambitious, you can run an Ubuntu container with:
24.  $ docker run -it ubuntu bash
25. 
26. Share images, automate workflows, and more with a free Docker ID:
27.  https://hub.docker.com/
28. 
29. For more examples and ideas, visit:
30. https://docs.docker.com/get-started/
31. 
32. 
33. 
34.

卸载

  • 删除docker及其安装时自动安装的所有包
sudo apt-get autoremove docker docker-ce docker-engine  docker.io  containerd runc
  • 查看docker其他没有卸载软件
1. dpkg -l | grep docker
2. dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
  • 卸载没有删除的docker相关插件(根据上一个命令返回的值)
sudo apt-get autoremove docker-ce-*  #后面要删除的是根据上个命令返回的值
  • 删除docker的相关配置&目录
1.  sudo rm -rf /etc/systemd/system/docker.service.d
2.  sudo rm -rf /var/lib/docker
  • 验证删除是否成功,找不docker命令说明卸载docker成功
docker --version

其他

相关文章
|
11天前
|
关系型数据库 MySQL 数据库
Docker Compose V2 安装常用数据库MySQL+Mongo
以上内容涵盖了使用 Docker Compose 安装和管理 MySQL 和 MongoDB 的详细步骤,希望对您有所帮助。
84 42
|
1月前
|
弹性计算 Ubuntu Linux
阿里云服务器一键安装Docker社区版教程,基于系统运维管理OOS
阿里云服务器一键安装Docker社区版教程,基于系统运维管理OOS自动化部署。支持Ubuntu 22.04/20.04、CentOS 7.7-7.9及Alibaba Cloud Linux 3.2104 LTS。前提条件:ECS实例需运行中且有公网。步骤:选择Docker扩展并安装,验证成功通过命令`docker -v`查看版本号。
297 79
|
4天前
|
监控 Linux PHP
【02】客户端服务端C语言-go语言-web端PHP语言整合内容发布-优雅草网络设备监控系统-2月12日优雅草简化Centos stream8安装zabbix7教程-本搭建教程非docker搭建教程-优雅草solution
【02】客户端服务端C语言-go语言-web端PHP语言整合内容发布-优雅草网络设备监控系统-2月12日优雅草简化Centos stream8安装zabbix7教程-本搭建教程非docker搭建教程-优雅草solution
52 20
|
15天前
|
Linux Docker 容器
安装docker-18.06报错Error: libseccomp conflicts with docker-18.06
通过这些步骤,您可以成功在CentOS上安装Docker 18.06,并解决libseccomp的冲突问题。这些方法确保系统兼容性,并保证Docker的正常运行。
52 27
|
5天前
|
Ubuntu API 网络虚拟化
ubuntu22 编译安装docker,和docker容器方式安装 deepseek
本脚本适用于Ubuntu 22.04,主要功能包括编译安装Docker和安装DeepSeek模型。首先通过Apt源配置安装Docker,确保网络稳定(建议使用VPN)。接着下载并配置Docker二进制文件,创建Docker用户组并设置守护进程。随后拉取Debian 12镜像,安装系统必备工具,配置Ollama模型管理器,并最终部署和运行DeepSeek模型,提供API接口进行交互测试。
102 15
|
3天前
|
消息中间件 Kafka Docker
docker compose 安装 kafka
通过本文的步骤,您可以快速在本地使用 Docker Compose 安装并配置 Kafka 和 Zookeeper。Docker Compose 简化了多容器应用的管理,方便快速搭建和测试分布式系统。
26 2
|
1月前
|
前端开发 应用服务中间件 nginx
docker安装nginx,前端项目运行
通过上述步骤,你可以轻松地在Docker中部署Nginx并运行前端项目。这种方法不仅简化了部署流程,还确保了环境的一致性,提高了开发和运维的效率。确保按步骤操作,并根据项目的具体需求进行相应的配置调整。
122 25
|
1月前
|
安全 数据安全/隐私保护 Docker
docker私有仓库harbor安装
通过以上步骤,您可以成功在企业内部安装和配置Harbor私有仓库,方便地管理和分发Docker镜像。Harbor不仅提供了基础的镜像管理功能,还增强了安全性、身份管理和审计功能,使其成为企业级容器镜像管理的理想选择。
100 22
|
26天前
|
弹性计算 Ubuntu Java
OS-Copilot-ubuntu镜像版本的具体测试使用(安装方式有单独注明)
作为一名个人开发者,我主要负责云资源的运维和管理。在使用OS Copilot的过程中,我遇到了一些配置问题,特别是在ECS实例中设置AccessKey时,但最终成功解决了。通过使用OS Copilot的-t/-f/管道功能,我大大提升了效率,减少了命令编写的工作量,特别是在搭建Java运行环境时效果显著。此外,| 功能帮助我快速理解文档,整体体验非常流畅,推荐给其他开发者使用。
39 6
|
9月前
|
Ubuntu 网络安全 数据安全/隐私保护
百度搜索:蓝易云【docker通过dockerfile安装sftp教程。】
现在,你已经通过 Dockerfile 成功安装了 SFTP,并且可以使用指定的用户名和公钥进行远程访问。请确保替换示例中的用户名、密码和公钥为自己的实际值。
194 1