Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get around the size limitation of Docker.qcow2 in the Docker for Mac?

Tags:

I have a large (100gb+) database that I'm trying to run with the official postgres image.

I can't store the data in a docker volume because the ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2 file in Docker for Mac has a size limitation of about 60gb.

I'm hesitant to mount a host directory as a volume because file access in mounted host directory volumes is much slower than regular volumes.

These are some useful links that go into more detail on these issues:

  • This discusses the size limitation of the Docker.qcow2 file
  • This also discusses the size limitation of the Docker.qcow2 file
  • This discusses the mounted host directory volume speed issue
  • This gives a nice description of how to replace the Docker.qcow2 file with a file that can grow larger
  • This discusses how the Docker.qcow2 file doesn't shrink as its contents are removed (this isn't directly related, but can further complicate the problem)

Do you all just eat the speed loss and mount a host directory? Do you manually create a qcow2 file that can grow larger with qemu (if you do this, do you need to maintain this file between upgrades)? Do you do something else to handle this issue?

like image 718
James Chevalier Avatar asked Sep 09 '16 01:09

James Chevalier


People also ask

How do I allocate more space to Docker?

eventually this guide helped me to resize/expand my docker volume. 2 - Shut down your VM, open VM Settings > Hard Disk(s) > change size of your 'virtual_disk. vmdk' (or whatever is your machine's virtual disk), then click Apply (see this guide).

Can I delete Docker qcow2?

qcow2 file causing it to grow in size, until it eventually becomes fully allocated. It stops growing when it hits this maximum size. You can stop Docker and delete this file, however deleting it will also remove all your containers and images.

What is Docker disk image size?

There is a size limit to the Docker container known as base device size. The default value is 10GB. This value can be changed to allow the container to have more size using dockerd --storage-opt dm. basesize=50G .

How do I determine the size of a Docker container?

To view the approximate size of a running container, you can use the command docker container ls -s . Running docker image ls shows the sizes of your images. To see the size of the intermediate images that make up your image use docker image history my_image:my_tag .


2 Answers

The following script delete and re-create a new shrinked Docker.qcow2 file preserving the images passed as arguments.

https://blog.mrtrustor.net/post/clean-docker-for-mac/

Hope this helps.

like image 131
obe6 Avatar answered Nov 04 '22 15:11

obe6


For a situation like this, I would definitely recommend creating a qcow image that can grow larger.

It is a relatively straightforward process, and you get the performance benefits that are generally quite necessary when running a large database.

like image 34
programmerq Avatar answered Nov 04 '22 17:11

programmerq