Browsing Category "AWS"

Search This Blog

Powered by Blogger.

Pages

Browsing "Older Posts"

Browsing Category "AWS"

Moving Docker's Directory

By TY → Sunday, October 11, 2015


We have an AWS instance that is running docker images. The AWS instance came with 8 GB of free space and we have mounted another data partition of 100 GB.

However, by default, the docker images are consuming space from within the 8 GB, which will not be sufficient, so we have got to move docker directory to the data partition that was mounted. The following steps worked for me.

  1. Default directory /var/lib/docker
  2. Stop docker service and move docker to data partition (in this case is "/data", you can mount your data partition anywhere, just replace "/data" with what you have)
    $ sudo stop docker
    $ sudo mv /var/lib/docker /data/docker
    
  3. Edit docker config, look for DOCKER_OPTS, add "-g /data/docker". Docker config can be found at /etc/default/docker.

    Final DOCKER_OPTS should be similar to the following:
    $ cat /etc/default/docker
    # Use DOCKER_OPTS to modify the daemon startup options.
    DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4 -g /data/docker"
    
  4. Start docker service.