Changing disk space of container partition

I used the command mentioned on the official docker page.

  • docker-machine create breaks at `DBG | Filling zeroes`
  • How to install docker-engine using docker binary without internet connection
  • Jersey Grizzly HTTP Server shutdown inside container docker
  • Golang websocket server on docker container won't send out message to outside world
  • Continuous deployment with docker
  • On Windows how the docker host connect to docker containers?
  • 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"

  • How to quickly switch Docker containers on production?
  • Saving docker container image
  • Docker Running the Java -JAR file to create Cassandra KeySpaces. But its not creating
  • Intergration of Docker with OpenStack via Docker Heat Plugin
  • “Error: spawn mongoexport ENOENT” when running dockerized node app
  • Docker-Compose won't volume my php.ini file
  • 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.