Changing disk space of container partition

I used the command mentioned on the official docker page.

  • Installing docker containers via chef with staged files
  • Dockerfile: skip passphrase for private key
  • docker-compose setup doesn't allow container to connect to redis
  • Is it possible to send string into running process inside docker container?
  • How to share a Docker container folder when it is not empty?
  • Can we control the k8s node run container members?
  • official command:

    docker run -i -t -p 8888:8888 continuumio/miniconda3 /bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir /opt/notebooks && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser"

    I mounted tmp folder within the container and used it as home directory because for some reason the root partition had only 10 GB disk allocated.

    docker run -i -t -p 8888:8888 -v /tmp/:/tmp/ continuumio/miniconda3 /bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && cd /tmp/ && /opt/conda/bin/jupyter notebook --ip='*' --port=8888 --no-browser --allow-root"

    I will like to know if there is any better way of doing this. The size of root partition should be the same as host machine hard disk capacity.


    I am using Dockerfile as suggested by shizhz. But here is the correct command if in case I need it:

    docker run -i -t -p 8888:8888 -v /tmp:/tmp continuumio/miniconda3 /bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && cd /tmp/ && /opt/conda/bin/jupyter notebook --notebook-dir=/tmp --ip='*' --port=8888 --no-browser --allow-root"

  • Unable to launch tomcat using docker
  • How to disable sticky sessions in Openshift3
  • cannot run container after commit changes
  • Running on runner-…-concurrent-0 via … runner for LONG time never ends
  • Determine if Docker image is signed or unsigned
  • Docker SIGTERM not being delivered to node.js/coffee app when started with flags
  • 2 Solutions collect form web for “Changing disk space of container partition”

    This is not about your disk partition but I think you’re doing too much things in startup shell, I’d like to suggest you to define your own Dockerfile and build your own image. I test with the following Dockerfile:

    FROM continuumio/miniconda3
    RUN /opt/conda/bin/conda install jupyter -y --quiet && mkdir /opt/notebooks
    VOLUME /opt/notebooks
    EXPOSE 8888
    WORKDIR /opt/notebooks
    CMD ["/opt/conda/bin/jupyter", "notebook", "--notebook-dir=/opt/notebooks", "--ip='*'", "--port=8888", "--no-browser", "--allow-root"]

    Then build your own image:

    docker build -t jupyter .

    After than you can easily start your service like:

    docker run -d -v `pwd`/notebooks:/opt/notebooks -p 8888:8888 jupyter

    Of course you can mount any directory on your host to VOLUME /opt/notebooks inside container.

    Docker by default allocates 10G of the data irrespective of the size of your host computer.

    There are some recent developments in this area and docker 3.18.0 has the best way of handling the things. Details of the same are available in docker documentation.

    As per the documentation, you would have to use the following sequence of commands to increase the base size of the containers/ images.

    • Please note the above command is an irreversable operation. Once you have set the size to 50G, you can’t ever get it reduced.
    • Also, this partition is currently possible only on ext4 partitions. Hence your host machine should have ext4 partition where docker is running and creating containers/ images from.

      $ sudo dockerd --storage-opt dm.basesize=50G
    • To let the changes take effect, you have to run the following commands:

      $ sudo service docker stop
      $ sudo rm -rf /var/lib/docker
      $ sudo service docker start

    Also, please note that this will effect all the future images that you pull / build and future containers you create. Existing containers are not affected by this command. Hence, you might have to re-create your images and re-create your containers.

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