Centos Stream9安装docker+portainer

WechatIMG415.png

  1. 首先我们安装系统必要工具

    yum install -y yum-utils device-mapper-persistent-data lvm2
    
  2. 然后添加软件源信息,以阿里源为例

    yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    
  3. 然后更新并安装docker-ce发现到这一步出现问题

    yum makecache
    
  4. 安装docker

    yum install -y --allowerasing docker-ce
    
  5. 启动docker

    sudo systemctl start docker
    
  6. 查看docker版本

    docker version
    
  7. 设置docker开机启动

    systemctl enable docker.service
    systemctl enable containerd.service
    
  8. 关闭docker开机启动

    systemctl disable docker.service
    systemctl disable containerd.service
    
  9. 安装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
    
  10. 设置镜像加速

    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
    
  11. 修改镜像文件储存路径

    vim /usr/lib/systemd/system/docker.service
    ExecStart=/usr/bin/dockerd --graph="/data/server/docker"
    重启docker
    systemctl daemon-reload
    systemctl restart docker
    
  12. 安装 portainer

    docker pull portainer/portainer
    
  13. 运行镜像

    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

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

提交评论