How to efficiently manage docker storage drive in Centos 7

I would like to clarify some questions with docker experts regarding usage of docker container in Centos 7. Please find the details about the docker,

$ docker version
Client:
 Version:      1.13.0
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Tue Jan 17 09:55:28 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.0
 API version:  1.25 (minimum version 1.12)
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Tue Jan 17 09:55:28 2017
 OS/Arch:      linux/amd64
 Experimental: false

I am using centos 7 and the version is CentOS Linux release 7.3.1611 (Core)

  • How can I ensure graceful scaling in kubernetes?
  • how do I clean up /dev/mapper/docker and release space?
  • Docker for Windows cleanup
  • How do I install things on Kitematic Boot2docker linux?
  • pcregrep with multiple capturing groups
  • How do share a directory with same name in the current directory with docker
  • I am currently having few issues related to managing the docker storage drive, so i am listing everything over here,

    1. If i am correct, Docker uses /var/lib/docker by default for saving all the information about images and container. My disk space in root directory is less than 20 gb and as soon as the container starts to process for few mins, the disk space filled up to 100%. So i have mounted a disk partition /dev/sdb. I have done lot search in google and everyone is suggested to configure the docker-storage-setup, but with the latest version of docker 1.13 i was not able to find the docker-storage-setup in order to make the docker use /dev/sdb for storing all the information about images and container. Can anyone explain how to make docker use the mounted disk partition /dev/sdb instead for /var/lib ?

      1. I am quite not familiar about docker volumes and would like to know whether mounting volume while starting container will solve the above mentioned issue or still docker will save all its information inside /var/lib ?

    EDIT :

    $ docker info
    
    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
    Plugins:
     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:
     seccomp
      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
    ID: WYAF:SDYL:LVAU:OKDP:O6K2:ZLG6:RMIB:SET4:SWGN:6TBR:ST6K:4W55
    Docker Root Dir: /var/lib/docker
    Debug Mode (client): false
    Debug Mode (server): false
    Registry: https://index.docker.io/v1/
    Experimental: false
    Insecure Registries:
     127.0.0.0/8
    Live Restore Enabled: false
    

    $ 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
    

    $ 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
    

  • EC2 AMI to docker image
  • Docker Mount an entire mounted host partition as a data volume
  • Vagrant docker shellinit?
  • click-and-run docker image (or VM) with web interface?
  • Docker - maven connect to specific repository in runtime
  • How can I force cancel dockerbuild using bash a command?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.