How can I adjust the container size following a successful build? #11

Closed
opened 2025-12-28 23:20:53 +01:00 by adam · 7 comments
Owner

Originally created by @ZackaryNisbet on GitHub (Jun 5, 2020).

In order to download Xcode, I need to upgrade to Catalina, which requires more storage than I allocated. I tried wiping my installed image and then reinstalling using the build arguments provided in the readme, but when partitioning the biggest disk on the new installation, I was still only able to use ~34GB despite the arguments to use 50GB.

Since the installation arguments didn't seem to work, I tried to fix this by taking an approach of simply resizing the image post-installation without losing data. I've tried looking through the reference documentation and other sources, but haven't found a solution that has helped me. Is it possible for me to resize my current docker image to increase the storage size? If not, why didn't the arguments change the accessible storage within the container?

For additional information, I'm running Ubuntu 20.04

Originally created by @ZackaryNisbet on GitHub (Jun 5, 2020). In order to download Xcode, I need to upgrade to Catalina, which requires more storage than I allocated. I tried wiping my installed image and then reinstalling using the build arguments provided in the readme, but when partitioning the biggest disk on the new installation, I was still only able to use ~34GB despite the arguments to use 50GB. Since the installation arguments didn't seem to work, I tried to fix this by taking an approach of simply resizing the image post-installation without losing data. I've tried looking through the reference documentation and other sources, but haven't found a solution that has helped me. Is it possible for me to resize my current docker image to increase the storage size? If not, why didn't the arguments change the accessible storage within the container? For additional information, I'm running Ubuntu 20.04
adam closed this issue 2025-12-28 23:20:53 +01:00
Author
Owner

@Fr0stykiller commented on GitHub (Jun 5, 2020):

I had the same issue with using --build-arg. Still, Dockerfile looks ok, so you can just change the VERSION and SIZE in Dockerfile itself and rebuild.

@Fr0stykiller commented on GitHub (Jun 5, 2020): I had the same issue with using `--build-arg`. Still, Dockerfile looks ok, so you can just change the `VERSION` and `SIZE` in Dockerfile itself and rebuild.
Author
Owner

@sickcodes commented on GitHub (Jun 5, 2020):

You can pull the .img out of the /var/lib/docker/.... location and play around with the sizes with gparted or something.

https://softwarebakery.com/shrinking-images-on-linux

It’s probably faster to just make a new one

Back it up before you play with it

Should I change the default to 60GB?

@sickcodes commented on GitHub (Jun 5, 2020): You can pull the .img out of the /var/lib/docker/.... location and play around with the sizes with gparted or something. https://softwarebakery.com/shrinking-images-on-linux It’s probably faster to just make a new one Back it up before you play with it Should I change the default to 60GB?
Author
Owner

@ZackaryNisbet commented on GitHub (Jun 5, 2020):

Should I change the default to 60GB?

Yes please. Everyone who builds this will need more than the 32GB to update to Catalina anyways. 60GB would be perfect for me.

@ZackaryNisbet commented on GitHub (Jun 5, 2020): > Should I change the default to 60GB? Yes please. Everyone who builds this will need more than the 32GB to update to Catalina anyways. 60GB would be perfect for me.
Author
Owner

@sickcodes commented on GitHub (Jun 5, 2020):

You can change the build args to download Catalina instead of Mojave.

@sickcodes commented on GitHub (Jun 5, 2020): You can change the build args to download Catalina instead of Mojave.
Author
Owner

@ZackaryNisbet commented on GitHub (Jun 6, 2020):

Just finished installing Xcode in my docker container with 50GB+. Thanks so much.

@ZackaryNisbet commented on GitHub (Jun 6, 2020): Just finished installing Xcode in my docker container with 50GB+. Thanks so much.
Author
Owner

@mikob commented on GitHub (Feb 25, 2021):

For anyone else trying to do this, I couldn't get it working with gparted, but I was able to do it this way:

  1. Resize the .img on the host (not sure if it's necessary)
    $ qemu-img resize /var/lib/docker/overlay2/.../diff/home/arch/OSX-KVM/mac_hdd_ng.img.img +10G

  2. Use the disk utility in MacOS to resize the partition so that it includes the new free space.

@mikob commented on GitHub (Feb 25, 2021): For anyone else trying to do this, I couldn't get it working with gparted, but I was able to do it this way: 1) Resize the .img on the host (not sure if it's necessary) `$ qemu-img resize /var/lib/docker/overlay2/.../diff/home/arch/OSX-KVM/mac_hdd_ng.img.img +10G` 2) Use the disk utility in MacOS to resize the partition so that it includes the new free space.
Author
Owner

@sickcodes commented on GitHub (Feb 25, 2021):

For anyone else trying to do this, I couldn't get it working with gparted, but I was able to do it this way:

  1. Resize the .img on the host (not sure if it's necessary)

$ qemu-img resize /var/lib/docker/overlay2/.../diff/home/arch/OSX-KVM/mac_hdd_ng.img.img +10G

  1. Use the disk utility in MacOS to resize the partition so that it includes the new free space.

That looks correct! The only other way to resize hfs plus on Linux is using hfsprogs. You can only grow a disk too, cannot shrink, so doing it inside MacOS is the only (safe) way, currently, that I'm aware of.

@sickcodes commented on GitHub (Feb 25, 2021): > For anyone else trying to do this, I couldn't get it working with gparted, but I was able to do it this way: > > > > 1) Resize the .img on the host (not sure if it's necessary) > > `$ qemu-img resize /var/lib/docker/overlay2/.../diff/home/arch/OSX-KVM/mac_hdd_ng.img.img +10G` > > > > 2) Use the disk utility in MacOS to resize the partition so that it includes the new free space. That looks correct! The only other way to resize hfs plus on Linux is using hfsprogs. You can only grow a disk too, cannot shrink, so doing it inside MacOS is the only (safe) way, currently, that I'm aware of.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#11