首页 > 编程知识 正文

卸载docker容器,windows卸载docker

时间:2023-05-04 05:03:44 阅读:195116 作者:4824

docker卸载

#卸载dockersudo apt-get remove dockersudo apt-get remove docker-engine docker.io#卸载docker-cesudo apt-get remove docker-ce#卸载安装依赖sudo apt-get autoremove --purge docker-ce上面的命令不会移除镜像、容器、卷或者是用户创建的配置文件,如果想卸载所有的镜像、容器、卷,可运行rm -rf /var/lib/docker 安装docekr 首先安装依赖sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common信任 Docker 的 GPG 公钥curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -对于 amd64 架构的计算机,添加软件仓库sudo add-apt-repository "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"最后安装sudo apt-get updatesudo apt-get install docker-ce把当前用户加到docker用户组中添加docker用户组sudo groupadd docker把自己加到docker用户组中#myusername 是你自己的用户名sudo gpasswd -a myusername docker重启docker后台服务sudo service docker restart切换当前用户到新groupnewgrp - docker确定docker可以非sudo运行docker ps

方法二:

卸载旧版本sudo apt-get remove docker docker-engine docker.io containerd runc安装依赖包sudo apt-get updatesudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common添加GPG key,并设置stable版本的仓库curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"apt-get安装sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.io验证安装结果sudo docker run --rm hello-world--rm参数代表我们运行后随即删除这个容器,因为我们只需要这个容器输出一段信息而已。执行后会输出类似这样的信息,说明已经安装成功:Hello from Docker!This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:The Docker client contacted the Docker daemon.The Docker daemon pulled the “hello-world” image from the Docker Hub.(amd64)The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare 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/免sudo运行每次运行docker都要加一个sudo挺麻烦,我们将当前账号加入Docker组里面即可免sudo运行Docker:sudo groupadd dockersudo gpasswd -a ${USER} dockersudo service docker restartnewgrp - docker ubuntu 完全干净的卸载docker

1. 删除某软件,及其安装时自动安装的所有包

sudo apt-get autoremove docker docker-ce docker-engine docker.io containerd runc

2. 删除docker其他没有没有卸载

dpkg -l | grep dockerdpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P # 删除无用的相关的配置文件

3.卸载没有删除的docker相关插件(结合自己电脑的实际情况)

sudo apt-get autoremove docker-ce-*

4.删除docker的相关配置&目录

sudo rm -rf /etc/systemd/system/docker.service.d sudo rm -rf /var/lib/docker

5.确定docker卸载完毕

docker --version

参考链接:https://blog.csdn.net/qq_29935433/article/details/104781692

http://chason.me/docker-tutorial/

https://www.cnblogs.com/shmily3929/p/12085163.html

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。