zoukankan      html  css  js  c++  java
  • Centos 7: 改变docker的image存放目录

    1.创建新的数据目录

    mkdir /data/docker

    2.关闭docker进程

    systemctl stop docker

    3.修改配置文件/usr/lib/systemd/system/docker.service

    vi /usr/lib/systemd/system/docker.service
    /usr/lib/systemd/system/docker.service
    [Unit]
    Description=Docker Application Container Engine
    Documentation=http://docs.docker.com
    After=network.target rhel-push-plugin.socket registries.service
    Wants=docker-storage-setup.service
    Requires=docker-cleanup.timer
    
    [Service]
    Type=notify
    NotifyAccess=all
    EnvironmentFile=-/run/containers/registries.conf
    EnvironmentFile=-/etc/sysconfig/docker
    EnvironmentFile=-/etc/sysconfig/docker-storage
    EnvironmentFile=-/etc/sysconfig/docker-network
    Environment=GOTRACEBACK=crash
    Environment=DOCKER_HTTP_HOST_COMPAT=1
    Environment=PATH=/usr/libexec/docker:/usr/bin:/usr/sbin
    ExecStart=/usr/bin/dockerd-current -g /data/docker 
              --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current 
              --default-runtime=docker-runc 
              --exec-opt native.cgroupdriver=systemd 
              --userland-proxy-path=/usr/libexec/docker/docker-proxy-current 
              --init-path=/usr/libexec/docker/docker-init-current 
              --seccomp-profile=/etc/docker/seccomp.json 
              $OPTIONS 
              $DOCKER_STORAGE_OPTIONS 
              $DOCKER_NETWORK_OPTIONS 
              $ADD_REGISTRY 
              $BLOCK_REGISTRY 
              $INSECURE_REGISTRY 
      $REGISTRIES
    ExecReload=/bin/kill -s HUP $MAINPID
    LimitNOFILE=1048576
    LimitNPROC=1048576
    LimitCORE=infinity
    TimeoutStartSec=0
    Restart=on-abnormal
    KillMode=process
    
    [Install]
    WantedBy=multi-user.target

    4. 复制之前的镜像数据到新的目录

    cp -R /var/lib/docker/* /data/docker/ 

    5.重新加载配置信息并启动

    systemctl daemon-reload
    systemctl start docker
  • 相关阅读:
    zookeeperclient代码解读
    封装scrollView 循环滚动,tableViewCell(连载) mvc
    PHP经典项目案例-(一)博客管理系统5
    Android插件化(三)载入插件apk中的Resource资源
    比树莓派配置好接地气的香蕉派上手初体验
    HDU Group
    JVM 类的卸载
    JVM 自定义类加载器
    JVM 初始化阶段例子
    JVM 初始化阶段例子 final常量
  • 原文地址:https://www.cnblogs.com/EikiXu/p/9505157.html
Copyright © 2011-2022 走看看