美文网首页
安装docker

安装docker

作者: 飞鹰雪玉 | 来源:发表于2022-05-06 14:45 被阅读0次

    在线安装docker

    curl -sSL https://get.daocloud.io/docker | sh
    systemctl start docker
    docker info
    

    修改镜像存储目录

    systemctl stop docker
    mkdir -p /data/docker/lib/
    rsync -avz /var/lib/docker /data/docker/lib/
    vim /usr/lib/systemd/system/docker.service
    

    添加配置:

    ExectStart=xxx --graph /data/docker/lib/docker
    

    修改镜像源

    vim /etc/docker/daemon.json
    

    添加配置:

    {
      "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
    }
    
    systemctl disable docker
    systemctl enable docker
    systemctl daemon-reload
    systemctl start docker
    

    离线安装docker-compose

    wget https://github.com/docker/compose/releases/download/v2.0.1/docker-compose-linux-x86_64
    mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
    chmod +x /usr/local/bin/docker-compose
    ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
    docker-compose --version
    

    在线安装docker-compose

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

    查看docker容器

    docker ps -a
    

    查看docker进程

    docker top CONTAINER [ps OPTIONS]
    #例如
    docker top redis
    

    相关文章

      网友评论

          本文标题:安装docker

          本文链接:https://www.haomeiwen.com/subject/iapvxrtx.html