天天看点

docker安装卸载

官方地址:

https://www.docker.com/

https://docs.docker.com/

https://hub.docker.com/

image:相当于一个应用的模板,可创建n个容器

container:独立运行一个或多个应用,可以把它认为成一个一个的小linux系统。

repository:存放image的地方,公有:docker hub, 私有的入:阿里云(可配置镜像加速)

 卸载

卸载:      
sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine      
yum install -y yum-utils
设置镜像仓库:      
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo  #默认,建议不用,网速太慢会使安装超程序时退出。

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo   #使用阿里云镜像代理      
yum clean all  #yum 会把下载的软件包和header存储在cache中而不自动删除。如果觉得占用磁盘空间,可以使用yum clean指令清除缓存      
yum makecache fast  #命令是将软件包信息提前在本地缓存一份,用来提高搜索安装软件的速度      
yum install docker-ce docker-ce-cli containerd.io  #下面是三个程序的解释
      

containerd.io - daemon to interface with the OS API (in this case, LXC - Linux Containers), essentially decouples Docker from the OS, also provides container services for non-Docker container managers

docker-ce - Docker daemon, this is the part that does all the management work, requires the other two on Linux

docker-ce-cli - CLI tools to control the daemon, you can install them on their own if you want to control a remote Docker daemon

#启动和查看docker状态
systemctl start docker
systemctl status docker

docker version

#试用docker
docker run hello-world      
docker images

卸载      
yum remove docker-ce docker-ce-cli containerd.io      
rm -rf /var/lib/docker      
rm -rf /var/lib/containerd      

若安装过程中有问题,可参考:

Centos7五步安装Docker并解决docker官方镜像无法访问问题  --  

下一篇: jdk安装卸载

继续阅读