zoukankan      html  css  js  c++  java
  • 修改docker镜像的默认存储目录

    1.首先停掉docker

    # systemctl stop docker

    2.修改系统服务的docker启动文件

    [root@ecs docker]# vi /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 /datas/storage/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

    3.重新加载守护进程

    # systemctl daemon-reload

    4.重启docker服务

    systemctl start docker

    5.验证结果

    (1)

    [root@ecs]# docker info
    Containers: 0
     Running: 0
     Paused: 0
     Stopped: 0
    Images: 0
    Server Version: 1.13.1
    Storage Driver: overlay2
     Backing Filesystem: extfs
     Supports d_type: true
     Native Overlay Diff: true
    Logging Driver: journald
    Cgroup Driver: systemd
    Plugins: 
     Volume: local
     Network: bridge host macvlan null overlay
    Swarm: inactive
    Runtimes: docker-runc runc
    Default Runtime: docker-runc
    Init Binary: /usr/libexec/docker/docker-init-current
    containerd version:  (expected: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1)
    runc version: e9c345b3f906d5dc5e8100b05ce37073a811c74a (expected: 9df8b306d01f59d3a8029be411de015b7304dd8f)
    init version: 5b117de7f824f3d3825737cf09581645abbe35d4 (expected: 949e6facb77383876aeff8a6944dde66b3089574)
    Security Options:
     seccomp
      WARNING: You're not using the default seccomp profile
      Profile: /etc/docker/seccomp.json
    Kernel Version: 3.10.0-693.11.1.el7.x86_64
    Operating System: CentOS Linux 7 (Core)
    OSType: linux
    Architecture: x86_64
    Number of Docker Hooks: 3
    CPUs: 4
    Total Memory: 7.639 GiB
    Name: ecs-d68e-0003.novalocal
    ID: 2UIG:WL75:4G6D:2VFS:YL7I:2OLN:O6IU:TTZQ:DBY2:F5VW:QOJQ:QJFS
    Docker Root Dir: /datas/storage/docker
    Debug Mode (client): false
    Debug Mode (server): false
    Registry: https://index.docker.io/v1/
    WARNING: bridge-nf-call-iptables is disabled
    WARNING: bridge-nf-call-ip6tables is disabled
    Experimental: false
    Insecure Registries:
     127.0.0.0/8
    Live Restore Enabled: false
    Registries: docker.io (secure)
     

    (2)

    [root@ecs docker]# cd /datas/storage/docker/
    [root@ecs docker]# ls
    containers  image  network  overlay2  plugins  swarm  tmp  trust  volumes

    完成

  • 相关阅读:
    keil编译器从ac5迁移到ac6
    分享一个简单易用的软件定时器模块(MultiTimer)——基于keil+stm32f103zet+hal库(裸机实现)
    PID动图——很形象
    jlink之j-scope使用
    Keil的RTX特性
    Keil5创建基于RTX的STM32工程(转载+自己的体会)
    CMSIS-RTOS 简介
    Chapter 3 Phenomenon——13
    Chapter 3 Phenomenon——12
    Chapter 3 Phenomenon——11
  • 原文地址:https://www.cnblogs.com/zbbiex/p/9254857.html
Copyright © 2011-2022 走看看