How to change docker installation directory in centos 7 with docker 1.13 version

I have enclosed the docker details below,

$ docker info

  • Need some advice dockerizing MongoDB
  • How to apply kernel tuning on docker container
  • Vagrant managed docker container doesn't start
  • why shipyard docker container does not start?
  • Play Framework + Docker : Database 'default' needs evolution
  • Lost connection to MySQL server when creating database from script in a Docker container
  • Containers: 3
     Running: 3
     Paused: 0
     Stopped: 0
    Images: 26
    Server Version: 1.13.0
    Storage Driver: overlay
     Backing Filesystem: xfs
     Supports d_type: false
    Logging Driver: json-file
    Cgroup Driver: cgroupfs
     Volume: local
     Network: bridge host macvlan null overlay
    Swarm: inactive
    Runtimes: runc
    Default Runtime: runc
    Init Binary: docker-init
    containerd version: 03e5862ec0d8d3b3f750e19fca3ee367e13c090e
    runc version: 2f7393a47307a16f8cee44a37b262e8b81021e3e
    init version: 949e6fa
    Security Options:
      Profile: default
    Kernel Version: 3.10.0-514.6.1.el7.x86_64
    Operating System: CentOS Linux 7 (Core)
    OSType: linux
    Architecture: x86_64
    CPUs: 8
    Total Memory: 15.51 GiB
    Name: docker
    Docker Root Dir: /var/lib/docker
    Debug Mode (client): false
    Debug Mode (server): false
    Experimental: false
    Insecure Registries:
    Live Restore Enabled: false

    $ docker system df

    TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
    Images              4                   3                   4.441 GB            -1.644e+09 B (-37%)
    Containers          3                   3                   6.867 GB            0 B (0%)
    Local Volumes       0                   0                   0 B                 0 B

    $ df -h

    Filesystem               Size  Used Avail Use% Mounted on
    /dev/mapper/centos-root   14G   14G  647M  96% /
    devtmpfs                 7.8G     0  7.8G   0% /dev
    tmpfs                    7.8G     0  7.8G   0% /dev/shm
    tmpfs                    7.8G   25M  7.8G   1% /run
    tmpfs                    7.8G     0  7.8G   0% /sys/fs/cgroup
    /dev/sda1                497M  216M  281M  44% /boot
    /dev/sdb                 296G   65M  281G   1% /mnt
    overlay                   14G   14G  647M  96% /var/lib/docker/overlay/dfa0c4e618c259bf046b454b27a7963fb31b9d4e95cc745ed28696b0791e3166/merged
    shm                       64M     0   64M   0% /var/lib/docker/containers/6e978cecc472322ef984cdb73117ed0243eb88c30d37c93827084bec88dcf15a/shm
    overlay                   14G   14G  647M  96% /var/lib/docker/overlay/9cdd3dc933f93febccaa7e06ba2f86023d3dd655614be5d9e636ab75f21873f4/merged
    shm                       64M     0   64M   0% /var/lib/docker/containers/ed44174945e331246f622e42a6ea646504075a91e4922168d895ed295cd24109/shm
    overlay                   14G   14G  647M  96% /var/lib/docker/overlay/c2bc2c73f0f3b0e717f8ea134aad8554ebb6b77c2dcfd85e8035a645bf75d074/merged
    shm                       64M     0   64M   0% /var/lib/docker/containers/26fd8e67dc7da80f6047add17aaddd7f67f763966d4a6b65d08680ac41774a28/shm
    tmpfs                    1.6G     0  1.6G   0% /run/user/0

    As we can see the space in root directory is filled up, so i would like to mount the docker installation directory to /mnt. Many suggested to include the -g option, but i couldnt able to provide that option.

    Could anyone please help me how to mount to /mnt directory and where to make those changes. I am using centos 7 and i have installed docker with the help of below link and i have followed exactly the same steps,

    And followed the steps provided here

    I couldnt find a docker file in /etc/sysconfig or in /etc/default. Please suggest where to change this

  • ASP.NET Core app crashing
  • Connection issue with Docker
  • Docker container unable to resolve localhost
  • Installing opencv in docker container
  • docker volume custom mount point [duplicate]
  • Deploy a docker container to production
  • One Solution collect form web for “How to change docker installation directory in centos 7 with docker 1.13 version”

    Centos 7 uses systemd, so you can create an override file in /etc/systemd/system/docker.service.d/override.conf that specifies alternate command flags to pass to dockerd when starting in order to use a directory other than /var/lib/docker for your container storage:

    ExecStart=/usr/bin/dockerd --graph=/mnt/docker-data --storage-driver=overlay

    Another option would be to mount the disk you have mounted at /mnt at /var/lib/docker directly.

    Further details are in the official docs.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.