码迷,mamicode.com
首页 > 系统相关 > 详细

linux系统docker版本升级或安装

时间:2019-04-16 20:28:45      阅读:315      评论:0      收藏:0      [点我收藏+]

标签:pre   lxc   imu   emctl   服务   curl命令   否则   版本升级   mon   

如果存在旧版本,则先卸载

最好先将镜像导出保存,以免升级后丢失或者无法使用

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

$ docker ps -q | xargs docker stop

关闭docker服务

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

查看已经安装的docker

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

将其卸载掉

$ 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

linux系统docker版本升级或安装

标签:pre   lxc   imu   emctl   服务   curl命令   否则   版本升级   mon   

原文地址:https://www.cnblogs.com/yanhai307/p/10719663.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!