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

其他

相关文章
|
4月前
|
Ubuntu 安全 iOS开发
Nessus Professional 10.10 Auto Installer for Ubuntu 24.04 - Nessus 自动化安装程序
Nessus Professional 10.10 Auto Installer for Ubuntu 24.04 - Nessus 自动化安装程序
390 5
|
4月前
|
NoSQL Ubuntu MongoDB
在Ubuntu 22.04上安装MongoDB 6.0的步骤
这些步骤应该可以在Ubuntu 22.04系统上安装MongoDB 6.0。安装过程中,如果遇到任何问题,可以查阅MongoDB的官方文档或者Ubuntu的相关帮助文档,这些资源通常提供了解决特定问题的详细指导。
493 18
|
5月前
|
关系型数据库 数据库 PostgreSQL
docker 安装 Postgres 17.6
本文介绍如何通过Docker安装和配置PostgreSQL 17.6。内容包括拉取镜像、导出配置文件、运行容器并挂载数据与配置文件目录,以及进入容器使用psql操作数据库的完整步骤,便于持久化管理和自定义配置。
750 3
docker 安装 Postgres 17.6
|
4月前
|
NoSQL 算法 Redis
【Docker】(3)学习Docker中 镜像与容器数据卷、映射关系!手把手带你安装 MySql主从同步 和 Redis三主三从集群!并且进行主从切换与扩容操作,还有分析 哈希分区 等知识点!
Union文件系统(UnionFS)是一种**分层、轻量级并且高性能的文件系统**,它支持对文件系统的修改作为一次提交来一层层的叠加,同时可以将不同目录挂载到同一个虚拟文件系统下(unite several directories into a single virtual filesystem) Union 文件系统是 Docker 镜像的基础。 镜像可以通过分层来进行继承,基于基础镜像(没有父镜像),可以制作各种具体的应用镜像。
636 5
|
4月前
|
Java Linux 虚拟化
【Docker】(1)Docker的概述与架构,手把手带你安装Docker,云原生路上不可缺少的一门技术!
1. Docker简介 1.1 Docker是什么 为什么docker会出现? 假定您在开发一款平台项目,您的开发环境具有特定的配置。其他开发人员身处的环境配置也各有不同。 您正在开发的应用依赖于您当前的配置且还要依赖于某些配置文件。 您的企业还拥有标准化的测试和生产环境,且具有自身的配置和一系列支持文件。 **要求:**希望尽可能多在本地模拟这些环境而不产生重新创建服务器环境的开销 问题: 要如何确保应用能够在这些环境中运行和通过质量检测? 在部署过程中不出现令人头疼的版本、配置问题 无需重新编写代码和进行故障修复
464 2
|
5月前
|
Ubuntu 安全 关系型数据库
安装MariaDB服务器流程介绍在Ubuntu 22.04系统上
至此, 您已经在 Ubuntu 22.04 系统上成功地完成了 MariadB 的标准部署流程,并且对其进行基础但重要地初步配置加固工作。通过以上简洁明快且实用性强大地操作流程, 您现在拥有一个待定制与使用地强大 SQL 数据库管理系统。
384 18
|
5月前
|
Ubuntu 安全 关系型数据库
安装MariaDB服务器流程介绍在Ubuntu 22.04系统上
至此, 您已经在 Ubuntu 22.04 系统上成功地完成了 MariadB 的标准部署流程,并且对其进行基础但重要地初步配置加固工作。通过以上简洁明快且实用性强大地操作流程, 您现在拥有一个待定制与使用地强大 SQL 数据库管理系统。
408 15
|
5月前
|
存储 Ubuntu iOS开发
在Ubuntu 22.04系统上安装libimobiledevice的步骤
为了获取更多功能或者解决可能出现问题,请参考官方文档或者社区提供支持。
425 14
|
5月前
|
Ubuntu 安全 关系型数据库
安装与配置MySQL 8 on Ubuntu,包括权限授予、数据库备份及远程连接指南
以上步骤提供了在Ubuntu上从头开始设置、配置、授权、备份及恢复一个基础但完整的MySQL环境所需知识点。
582 7
|
5月前
|
消息中间件 人工智能 运维
Ubuntu环境下的 RabbitMQ 安装与配置详细教程
本文聚焦在Ubuntu下RabbitMQ安装与配置教程,旨在帮助读者快速构建稳定可用的消息队列服务。
1107 6