天天看點

Docker 基礎9

可見 docker.service 是依賴于 docker.socket 的,但是并不必要開啟

Tip: 其實上面的步驟完成,就已經能保證docker會開機啟動,原因是它依賴的 docker.socket 雖然本身設定為不要開機啟動,但開機時會被systemctl檢查然後觸發啟動以支援 docker.service 的運作

可以用上面方法也将 docker.socket 設為開機啟動(但這一步不是非常必要)

[root@h103 ~]# systemctl list-unit-files| grep docker
docker.service                              enabled 
docker.socket                               disabled
[root@h103 ~]# systemctl enable docker.socket
Created symlink from /etc/systemd/system/sockets.target.wants/docker.socket to /usr/lib/systemd/system/docker.socket.
[root@h103 ~]# systemctl list-unit-files| grep docker
docker.service                              enabled 
docker.socket                               enabled 
[root@h103 ~]#            

複制

解除安裝Docker

列出安裝包

[root@h103 ~]# yum list installed | grep docker
docker-engine.x86_64                  1.9.1-1.el7.centos             @dockerrepo
docker-engine-selinux.noarch          1.9.1-1.el7.centos             @dockerrepo
[root@h103 ~]#            

複制

删除軟體包

[root@h103 ~]# yum -y remove docker-engine.x86_64
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package docker-engine.x86_64 0:1.9.1-1.el7.centos will be erased
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================
 Package                         Arch                     Version                                 Repository                     Size
======================================================================================================================================
Removing:
 docker-engine                   x86_64                   1.9.1-1.el7.centos                      @dockerrepo                    36 M

Transaction Summary
======================================================================================================================================
Remove  1 Package

Installed size: 36 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : docker-engine-1.9.1-1.el7.centos.x86_64                                                                            1/1 
  Verifying  : docker-engine-1.9.1-1.el7.centos.x86_64                                                                            1/1 

Removed:
  docker-engine.x86_64 0:1.9.1-1.el7.centos                                                                                           

Complete!
[root@h103 ~]#            

複制

這種情況下,隻删除了軟體包,但是沒有删除鏡像,容器,卷和自己建立的本地配置