linux系統docker版本升級或安裝


如果存在舊版本,則先卸載

最好先將鏡像導出保存,以免升級后丟失或者無法使用

如有正在運行的容器,先停止

$ docker ps -q | xargs docker stop

關閉docker服務

$ systemctl stop docker.service
$ systemctl stop docker.socket

查看已經安裝的docker

$ apt list --installed | grep docker
lxc-docker/unknown,now 1.9.1 amd64 [installed]
lxc-docker-1.9.1/unknown,now 1.9.1 amd64 [installed,automatic]

將其卸載掉

$ apt remove lxc-docker
$ apt remove lxc-docker-1.9.1

安裝docker最新版本

確定已經安裝curl命令,沒有安裝,則運行

$ apt install curl

運行命令安裝

$ curl -fsSL https://get.docker.com/ | sh

安裝完成后會有提醒

If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
         for more information

意思是:
當要以非root用戶可以直接運行docker時,需要執行 sudo usermod -aG docker runoob 命令,然后重新登陸,否則會報錯

重啟docker服務

$ systemctl restart docker

查看版本

$ docker version 
Client:
 Version:           18.09.5
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        e8ff056dbc
 Built:             Thu Apr 11 04:44:28 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.5
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       e8ff056
  Built:            Thu Apr 11 04:10:53 2019
  OS/Arch:          linux/amd64
  Experimental:     false


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM