0
点赞
收藏
分享

微信扫一扫

ubuntu 20.04 安装docker指定版本 19.03.15 以及安装docker管理工具portainer

古月无语 2023-04-03 阅读 34

安装docker

1.先卸载docker 防止已经安装过docker
sudo apt-get remove docker docker-engine docker.io containerd runc

2.安装依赖
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

5.导入阿里云证书
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

6.设置阿里云稳定仓库
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"


清华源证书(与阿里云二选一)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
清华源稳定仓库(与阿里云二选一)
sudo add-apt-repository "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"


7.更新仓库 (其实就是在 /etc/apt/sources.list 加了docker源)
apt update

8.查看docker都有那些版本
apt-cache madison docker-ce

9.安装指定版本docker 19.03.15版本 比较稳定 用的人多
apt install docker-ce=5:19.03.15~3-0~ubuntu-focal docker-ce-cli=5:19.03.15~3-0~ubuntu-focal

检查是否安装成功
 docker --version
 显示如下
Docker version 19.03.15, build 99e3ed8919
10.docker命令
启动docker
sudo systemctl start docker
查看docker服务运行状态
sudo systemctl status docker



#############以下操作为可选##############
为了以后管理docker方便 安装一个portainer 用于管理docker容器

1.下载portainer 镜像
docker pull portainer/portainer

2.运行portainer 下载镜像并启动容器 开机自启动
docker run -d -p 9000:9000 --restart=always -v /var/run/docker.sock:/var/run/docker.sock --name prtainer-test portainer/portainer

3.验证安装 
浏览器访问服务器9000端口
http://10.10.201.161:9000/
并设置admin密-码
(portainer的local的Container里 可以看到容器的启动情况)

举报

相关推荐

0 条评论