天天看點

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官方鏡像無法通路問題  --  

繼續閱讀