首页 > 系统服务 > 详细

ubuntu 安装 docker

时间:2020-09-24 15:59:59      阅读:41      评论:0      收藏:0      [点我收藏+]

没有安装过 docker 的 ubuntu 安装 docker的步骤:

$ sudo apt-get update

$ sudo apt-get install     apt-transport-https     ca-certificates     curl     gnupg-agent     software-properties-common

如果选择官方的源:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88

如果选择阿里的源:

sudo curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add -
sudo apt-key fingerprint 0EBFCD88

添加官方仓库:

sudo add-apt-repository    "deb [arch=amd64] https://download.docker.com/linux/ubuntu    $(lsb_release -cs)    stable"

添加阿里仓库:

sudo add-apt-repository    "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu    $(lsb_release -cs)    stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
apt-cache madison docker-ce

从上面输出的版本中找到你需要的版本:

sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

如果这里报错,可以尝试这个命令,我用这个命令进行安装就没有问题:

sudo apt-get -y install docker-ce=[VERSION]
sudo docker run hello-world
sudo gpasswd -a 用户名 docker
sudo service docker restart
newgrp - docker

安装 docker-compose,先去 https://github.com/docker/compose/releases 找到你需要的版本,然后替换下面的 1.24.1 这个版本号,我用的是 1.27.3 :

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version

参考: https://docs.docker.com/engine/install/ubuntu/
https://www.cnblogs.com/walker-lin/p/11214127.html
https://www.runoob.com/docker/docker-compose.html
https://blog.csdn.net/liqi_q/article/details/83030737
https://www.cnblogs.com/grow1016/p/11533645.html

ubuntu 安装 docker

原文:https://www.cnblogs.com/ramlife/p/13723755.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!