docker安装 与 基本配置

  1. 1、安装docker

    1. #yum remove docker \
    2. docker-common \
    3. container-selinux \
    4. docker-selinux \
    5. docker-engine \
    6. docker-engine-selinux
    7. #sudo yum install -y yum-utils device-mapper-persistent-data lvm2
    8. #yum-config-manager --enable extras
    9. #curl https://download.docker.com/linux/centos/docker-ce.repo > /etc/yum.repos.d/docker-ce.repo
    10. #yum makecache fast
    11. #yum install docker-ce

    2、加速

    1. #curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://50208f86.m.daocloud.io

    3、设置IP段

    1. #vim /etc/docker/daemon.json
    2. {
    3. "bip":"192.168.100.1/24"
    4. }

    4、修改docker存储路径
    vim /etc/docker/daemon.json

    1. {
    2. "graph": "/new-path/docker"
    3. }

    5、设置容器代理

    1. #cat /usr/lib/systemd/system/docker.service
    2. [Service]
    3. Environment="HTTP_PROXY=http://10.53.xx.xx:1080/"

    6、常用命令

      1. 启动服务:systemctl restart docker
      2. docker信息: docker info
      3. 启动容器:docker run xxxxx
      4. 重启容器:docker restart 容器名或者ID
      5. docker-compose:
      6. docker-compose up -d
      7. docker-compose down

猜你喜欢

转载自www.cnblogs.com/Qing-840/p/9263457.html