What is Docker.qcow2? - docker

I was looking at my disk with DaisyDisk and I have a 30GB something called Docker.qcow2. More specifically, DaisyDisk puts it under ~/Library/Containers/com.docker.docker/Data/vms/0/Docker.qcow2. Is it some kind of cache? Can I delete it? I have a lot of images from old projects that I won't ever use and I'm trying to clear up my disk.

The .qcow2 file is exposed to the VM as a block device with a maximum size of 64GiB by default. As new files are created in the filesystem by containers, new sectors are written to the block device. These new sectors are appended to the .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. And Docker will recreate this file on start.

If you stumbled upon this, you're probably not stoked about a 64gb file. If you open up Docker > Preferences, you can tone it down quite a bit to a more reasonable size. Doing this will delete the old cow file, and that will delete your containers, so be careful.

I've had the same issue. Instead of deleting the file or adjusting the size using the settings simply use the following commands:
docker images
This will show all of the images on your system and the size of each image (you'd be surprised how quickly this can get out of hand).
docker image rm IMAGEID
This will remove the image with the ID that you can get from the images command above.
I use this method and it frees up a lot of disk space.

Related

Why is a new docker image the same size of the original one from which the commit was made?

I downloaded a Docker image and made some changes inside a container based on it. Then I commited those changes to create a new image that I would actually like to use.
docker images says that these images have about the same size. So, it seemed to me that Docker copied everything it needs to the new image.
Yet I can't remove the old image which I no longer need. It seems like I'm getting the worst of both worlds: neither is space conserved by a parenting relationship, nor can I delete the unwanted files.
What gives? Am I interpreting docker images output wrong (maybe it's not reporting the actual on-disk size)?
you may remove the first image with a force,
docker image rm -f $IMAGE_ID
As for the same size, it depends mainly on your changes, you can check if they match exactly on a byte level with:
docker image inspect IMAGE_NAME:$TAG --format='{{.Size}}'

Creating MBTiles file with varied levels of detail using existing OpenMapTiles docker tasks?

I'm working hard to get up to speed with OpenMapTiles. The quickstart.sh script usually runs to completion so I've preferred it as a source of truth over the sometimes inconsistent documentation. Time to evolve.
What is the most efficient way to build an MBTiles file that contains, say, planet-level data for zooms 0-6 and bounded data for zooms 7-13, ideally for multiple bounded areas (e.g., a handful of metro areas). Seems a common use case during development. Can it be done with the existing Docker tools?
Did you try to download a OSM file from http://download.geofabrik.de/index.html and place it in /data folder, as stated in the quickstart.md (https://github.com/openmaptiles/openmaptiles/blob/master/QUICKSTART.md) ?
Placing the osm.pbf file in your /data folder and adjusting the .env and openmaptiles.yaml file to your preferred zoom should help you with a next step.
I'm not sure what you mean with the bounds.

Searching for the MLO file on the Beaglebone Black

I have a Beaglebone Black industrial(BBBI), which I assume is very similar to the Beaglebone Black.
I wish to make the BBBI boot to microSD card by default, and I found this guide, which suggested to delete the MLO file from the boot partition. This has been mentioned in a few places based on Google, so I assume it is worth trying
With the intention of renaming the MLO file, I tried to locate the file using $locate, after booting without a microSD card, which presumably boots into Debain on the eMMC. This produces the following:
/opt/backup/uboot/MLO
/opt/source/pru-software-support-package/pru_cape/bin/MLO
/opt/source/pru-software-support-package/pru_cape/bin/MLO/beaglebone
/opt/source/pru-software-support-package/pru_cape/bin/MLO/beaglebone_black
/opt/source/pru-software-support-package/pru_cape/bin/MLO/beaglebone_black/MLO
/opt/source/pru-software-support-package/pru_cape/bin/MLO/beaglebone/MLO
I have double checked that /boot does not have MLO. Is anybody able to share where the MLO is, or did I missed something very obvious?
Alternatively, is there an easier way to boot from the microSD card without pressing the S2 button?
Newer images put MLO outside the filesystems, directly at several "magic" offsets on the eMMC/SD-card. That's documented in the TRM for AM335x.
If you don't care about current eMMC contents, something like this will do the brute force job:
dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=1 (make sure mmcblk0 is the eMMC, not the SD card, it changes if you boot from SD and can be mmcblk1 too)
It wipes out the first Megabyte of the eMMC with zeroes. So the partition table and other things are gone too. Essentially you get a blank eMMC.
If you want to be a bit more surgical, look at the flashing script in /opt/scripts. Also functions.sh is interesting.
Note that MLO is also referred to as SPL.
Try editing the uenv.txt file to load the image from the SDCARD always.

GC collection of Docker Registry

Since v2.4.0 a garbage collector command is included within the registry binary. I read about how it works in the official documentation.
To use the garbage-collection:
bin/registry garbage-collect [--dry-run] /path/to/config.yml
I see the config in /etc/docker/registry/config.yml
When I just perform a dry-run I see a lot of blobs marked and at the end the blobs which would have been deleted without dry-run.
But I don't see how I can easily link this blobs to images?
Which images will be deleted and am I able to tell which image should be deleted or do I need to use another command and after that I have to run the gc?)
Can someone maybe provide an example in which case an image/blob will be deleted? Thanks
From your referenced documentation:
In the context of the Docker registry, garbage collection is the process of removing blobs from the filesystem which are no longer referenced by a manifest. Blobs can include both layers and manifests.
Manifests are groups of blobs (layers) used to represent an image tag. The only blobs deleted no longer reference any image. So to answer your question, if GC is working correctly, no one should be able to give an example of this deleting an image, but every useful GC should delete blobs, including your own.

Small change in large file in Docker container produces huge layer

I am using docker to have versioned database on my local dev environment (e.g. to be able to snapshot/revert db state). I need it due to nature of my work. I can not use transactions to achieve what I want [one of reasons - some of statements are DDL]
So, I have docker container with one large file (MySQL Inno db file)
If I change this file a little bit (like update row in table), and then commit container, new layer will be created, and size of this layer will be size of this huge file, even if only couple of bytes in file changed.
I understand it happens because for docker file is 'atomic' structure, if file is being modified its copy is created in new layer, and this layer is later included in image
Is there a way to change this behavior and to make Docker to store diffs on file level, e.g. if 10 bytes of 10 GiG file was changed, create layer with size smaller then 10 GiG?
Mb I can use some other storage engine? [which one?]
I also not very bound to docker, so I can even switch to rkt, question is - do you guys think it can help? (mb image format is different and can store diffs on file content level)

Resources