Centos Stream9安装docker+portainer

Post Time:2022-09-25 08:49:05 Views:364 编辑

WechatIMG415.png

  1. 首先我们安装系统必要工具
yum install -y yum-utils device-mapper-persistent-data lvm2
  1. 然后添加软件源信息,以阿里源为例
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  1. 然后更新并安装docker-ce发现到这一步出现问题
yum makecache
  1. 安装docker
yum install -y --allowerasing docker-ce
  1. 启动docker
sudo systemctl start docker
  1. 查看docker版本
docker version
  1. 设置docker开机启动
systemctl enable docker.service
systemctl enable containerd.service
  1. 关闭docker开机启动
systemctl disable docker.service
systemctl disable containerd.service
  1. 安装docker-compose
sudo pip install -U docker-compose
pip在centos也没有,如下处理
1.查看是否安装依赖包,没安装先安装:
sudo yum install epel-release
2.更新文件库
sudo yum -y update
3.安装pip
sudo yum -y install python-pip
  1. 设置镜像加速
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://hub-mirror.c.163.com/"]
}
EOF

重启docker
systemctl daemon-reload
systemctl restart docker
  1. 修改镜像文件储存路径
vim /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --graph="/data/server/docker"
重启docker
systemctl daemon-reload
systemctl restart docker
  1. 安装 portainer
docker pull portainer/portainer
  1. 运行镜像
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock --restart=always --name prtainer portainer/portainer

卸载docker

sudo yum remove docker-ce docker-ce-cli containerd.io
Comments: 3
暂无评论

「人生在世,留句话给我吧」

撰写评论