Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increase Docker container size from default 10GB on rhel7

When I launch a container from rhel7.3 image, the default container size is 10GB. I want to increase it to 20GB. I tried the below ways but I had no luck

1) Added "DOCKER_STORAGE_OPTIONS": "--storage-opt dm.basesize=20G" in /etc/docker/daemon.json file. /etc/docker/daemon.json file is not there by default so I had to add it and tried restarting docker. Restart fails with the below error:

"unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives don't match any configuration option: DOCKER_STORAGE_OPTIONS\n"

2) Added "dm.basesize=20G" parameter while I launch the conatiner

docker run --privileged --storage-opt "dm.basesize=20G" -d IMAGE_ID but it fails to launch with error

"docker: Error response from daemon: Unknown option dm.basesize."

Any help on how I can achieve to launch a container with 20GB instead of the default 10GB? Thanks, Premchand

like image 254
Premchand Avatar asked Dec 03 '22 20:12

Premchand


2 Answers

I changed the storage type to "Overlay" by the following steps

1) Added {"storage-driver": "overlay"} in /etc/docker/daemon.json file. This file was not there in rhel 7.3 so I added it manually.

2) Restarted docker

My issue of increasing the container volume is resolved as each container get total amount of volume available on the host.

like image 199
Premchand Avatar answered Jan 13 '23 16:01

Premchand


Had the same issue as you, after a lot of research i found a simple solution:

  1. stop the docker service:

    sudo systemctl stop docker

  2. edit your docker service file, located at:

    /usr/lib/systemd/system/docker.service

  3. find the execution line:

    ExecStart=/usr/bin/dockerd
    and change it to:
    ExecStart=/usr/bin/dockerd --storage-opt dm.basesize=20G

  4. start docker service again:

    sudo systemctl start docker

all done.

like image 44
Daniel I Avatar answered Jan 13 '23 16:01

Daniel I