CentOS/Ubuntu 安装 Docker和Portainer

在两个环境下安装了Docker及Portainer,记录下以供日后查阅

CentOS7部分

1.清理旧版本

$ sudo yum remove docker \
              docker-client \
              docker-client-latest \
              docker-common \
              docker-latest \
              docker-latest-logrotate \
              docker-logrotate \
              docker-engine

2.加repository

$ sudo yum install -y yum-utils

$ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

3.通过repository安装

$ sudo yum install docker-ce docker-ce-cli containerd.io
$ sudo systemctl start docker

3.1.通过rmp包安装(本人未执行)

$ sudo yum install /path/to/package.rpm
$ sudo systemctl start docker

4.安装Portainer

$ docker volume create portainer_data
$ docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

5.访问

http://YOUR-DOCKER-HOST:9000

UBUNTU部分

1.更新

# sudo apt-get update -y

2.安装Docker

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

3.安装gpg-key

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

4.更新源

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

5.安装Portainer

# docker volume create portainer_data
# docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

6.访问

http://YOUR-DOCKER-HOST:9000

 

参考:https://www.chucklindblom.com/centos-install-docker-portainer/

https://www.hostnextra.com/kb/how-to-install-portainer-on-ubuntu/

https://docs.fuga.cloud/how-to-install-portainer-docker-ui-manager-on-ubuntu-20.04-18.04-16.04

posted on 2023-03-27 11:58  BoneKing  阅读(550)  评论(0编辑  收藏  举报