Docker VM disk size on Windows 10 - windows

I'm running Docker on Windows 10 and got an error today that it's full. I just have 1 image (postgresql 10.1-alpine 38.2MB) and have removed everything else. I also ran docker system prune --force which freed up 0MB.
I've read that it is (or was) a known issue on Windows 10, that deleting containers leaves stuff behind. However, if I go into my %USERPROFILE%\.docker\machine\machines\default I find the VM disk file (disk.vmdk) that's 18GB in size!
Aside from uninstalling and reinstalling, is there any way to reduce the size of this file?

You can also prune the unused volumes, these consume a lot of space.
docker system prune --force --volumes

Related

Why docker desktop is unable to start docker-backend?

Problem:
I started my system as usual but my docker-desktop doesn't work, WSL doesn't respond to commands and there is a process called "Vmmem" using 25% of my memory. I have tried a bunch of thing but nothing seems to work.
System Attributes:
Windows 10 Pro (10.0.19045.2486)
docker: 4.15
WSL: 1.0.3.0
More context:
Recently I was having trouble with my docker set up. I have one particular container that was "crashing" the docker. It was not throwing any exception but after some event (that I couldn't find out) all the other container where unreachable any attempt to stop/start another container would result on "Error: 500 failed to respond...". When this happens I usually just restart the system and everything works fine, but today it wasn't the case. I restarted and I noticed that I had the "Vmmem" process already running at 25% (it usually just reaches this point at the end of the day), the docker desktop could not start the docker backend and when I tried running wsl -l -v I got no response. I can use some docker commands like docker -v but the docker compose up doesn't work at all.
What I've tried:
restart the system again (nothing changed, still starting with 25% mem usage)
deactivating Hyper-V (nothing happened)
stop/start docker service using net start/stop <service> (it gives a response but didn't solve the problem)
Uninstall docker-desktop (it crashes before even starting the uninstall process)
Terminate WSL wsl -t Ubuntu (got no response from wsl)
Overwrite installation with Docker 4.16 (it gets stuck on "Preparing for update... / Stopping VM and preparing for update")
Forcefully kill the "Vmmem" (I've got Access denied error)
Edit 1:
I managed to finally install the Docker desktop 4.16 but the problem continues, system starts with 25% Vmmem memory usage and docker desktop is not able to initiate backend.
the process Vmeem It represents the memory and CPU consumed by the combination of all the virtual machines running on your Windows PC, there is a possibility that processes are still running on your PC. I recommend you try to launch these commands from the console:
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
This will stop all containers and delete them.
If this doesn't work, I recommend you enter your bios settings and disable virtualization, that way those processes will stop, then you can enable it again and try. I wish you luck and I hope this resolves.
Steps that I did to be able to stop "Vmmem" process and install docker desktop again:
disable Hyper-V
disable virtualization (BIOS)
restart system
to this point the "Vmmem" problem was gone
uninstall docker desktop
rm all wsl instances
enable Hyper-V
enable hypervisorlaunchtype
restart system
enable virtualization (BIOS)
install wsl Ubuntu instance
install Docker Desktop
Maybe some steps listed here are redundant but that is what I did. hope it helps if other people is passing through the same problem

Increasing disk size in Vagrant archlinux using resize2fs

I am currently running a Vagrant box with archlinux for development purposes. I wanted to go beyond the 2GB so I installed the vagrant-disksize plugin and after ssh'ing into the box and changing the partition size, I ran resize2fs as suggested here.
However, when I do that, I get the following error:
resize2fs: Device or resource busy while trying to open /dev/sdax
Couldn't find valid filesystem superblock.
Here's what the man page says about resize2fs:
If the filesystem is mounted, it can be used to expand the size of the
mounted filesystem, assuming the kernel and the file system supports
on-line resizing.
How can I use resize2fs with my archlinux box?
tldr: resize2fs doesn't work on btrfs
Resolution:
After investigating the issue, I found out that the archlinux Vagrant box was set up with btrfs instead ext4. If you want to expand your disk size on Vagrant/VirtualBox and Arch Linux you will have to.
Steps to follow
Increase the physical disk size by either 1. using the Vagrant disk-resize plugin, 2. manually dismounting and cloning the drive with VBoxManage, or 3. activating the Vagrant experimental feature flag (oct. 2020).
Resize the partition inside the OS with {,c}fdisk or parted.
Check the file system on your partition with lsblk --fs. If you happen to run on btrfs, you won't be able to use resize2fs. You'll have to go through
btrfs filesystem resize max / (the mount point)
A few links that could be of use:
https://www.suse.com/support/kb/doc/?id=000018798
https://gist.github.com/christopher-hopper/9755310
https://askubuntu.com/questions/317338/how-can-i-increase-disk-size-on-a-vagrant-vm

Run a docker container in Windows

I have a Linux x86 application inside a docker container and I want to run it under Windows. I don't want to force users to install Virtual Box. Ideally a qemu or similar virtualization tool can be used, since it is very tiny and requires no installation at all.
My approach was to use qemu for Windows and
boot2docker, so I can boot a minimal Linux with docker installed and than run my docker container within it.
This is the command I'm using to run it:
qemu-system-x86_64.exe -m 256 -cdrom boot2docker.iso
The boot goes well, but I have several problems:
at every boot the image goes trough all the configuration steps (generating keys for ssh, setting hostname, etc.) that can be skipped the second time the image runs; seems that the changes to the image are not persisted trough runs. I want to build an image that is already configured and needs only to boot;
to add my application inside the image I have to rebuild the whole boot2docker.iso image by using the steps described in How to build boot2docker.iso locally.
So, the question is: how can I use the base boot2docker.iso image and add some persisting data (such as configurations and my application)? Perhaps a read/write partition mounted from another file?
like the idea.
Maybe you can check MobaliveCD, it has a nice lightweight GUI and it embeds qemu system inside. I tried it for tinycore live cd iso (base of boot2docker), which works quite ok.
While it seems it doesn't support 64bit (which boot2docker needs), but the function fits for you need.
Your command
qemu-system-x86_64.exe -m 256 -cdrom boot2docker.iso
launches an ISO, what you want is
reserve some disk place for this iso in a .img
run this iso and install it in this .img
reboot
In a Linux you would start by doing
qemu-img create -f qcow2 /home/myuser/my_image.img 6G
There is docker-cli for Windows, it seems to be what you look for, see
http://azure.microsoft.com/blog/2014/11/18/docker-cli-for-windows-clients/
You can use boot2docker http://boot2docker.io/
On boot2docker installation, it will install virtualbox behind the scenes.
You only have to start the boot2docker shortcut and the virtual box management and vms are hidden.

docker does not run on windows error

I've installed docker and followed the directions here: https://docs.docker.com/installation/windows/#installation but when I run boot2docker start this happens:
Trying to get IP one more time
exit status 255
Docker client does not run on Windows for now. Please use
"boot2docker" ssh
to SSH into the VM instead
Trying boot2docker ssh results in the same 255 error. I tried to get the VM IP with boot2docker IP but that also yielded nothing - I presume because boot2locker wasn't successful in the start process.
A couple of observations...I lloked at the vm settings and there wasn't any network or storage settings specified and the memory allocation in the vm settings didn't match the values in the config (boot2docker config). The boot2docker start/stop commands work.
I'm stumped.
I observed similar issue. Following steps helped me:
Open VirtualBox GUI.
Remove boot2docker-vm virtual machine.
Start Boot2Docker Start --- it will recreate boot2docker-vm virtual machine.
We had exactly this on someone's machine.
The solution for us was to find the
Run the VirtualBox UI (C:\program files\oracle....)
locate the VM (at the top)
select 'power off'
Once all that was done, boot2docker started correctly again.
In extremis, you could delete the boot2docker-vm image out of virtualbox, and it ought to re-install it.
go to the Oracle VM VirtualBox Manager, power off boot2docker-vm and start again. It worked for me.
just in case it helps. My problem was because boot2docker's default settings is beyond my laptop's capability (I know). I fixed the problem by changing the properties of boot2docker-vm through the VirtualBox GUI. Soon as I open thr properties I saw a few warnings at the bottom of the dialogue box, so I followed the hint and resolve those warnings, save the setttings and was able to start docker then.
I changed the CPU from 4->1, memory from 2G to 1.5G and video memory to 20M. Hope it helps.
Mostly you didn't enable the "Virtualization" in your BIOS. boot2docker needs to install 64bit OS in Virtualbox.
Its worth noting I had some huge problems trying to run docker on windows. Boot2docker would install OK with VritualBox 4.3.20. I could NOT run boot2docker or docker itself.
It took me ages to figure out that I had uninstall VirtualBox 4.3.20 and use 4.3.12 instead which worked first time like a treat!
So.. for Windows boot2docker only use VirtualBox 4.3.12.

Docker base image running slowly Mac OS X

So I have docker set up on OS X by using boot2docker. I have everything working, however, when I run docker run -i -t base /bin/bash it works, the prompt shows up... but it is EXTREMELY slow. By slow, I mean that if I would type one character, it takes about 30 seconds to a minute for that character to show up on the screen. I checked my Activity Monitor to make sure my system wasn't low on memory but that was not the case. It was showing around 85% of idle memory while this process was running. I was curious to see if anyone else on OS X was experiencing issues like this. Any input would be appreciated.
I've experienced the very same problem and as Julian already stated, it's a known issue. But, there is one post in that issue-thread that worked for me (well, at least an adapted version of it).
./boot2docker stop # stop a currently running deamon-instance
./boot2docker delete # remove the vm
rm -rf boot2docker.iso # in my case I had a (very old) iso-image
At this stage any new attempt to re-initialize the boot2docker-vm failed for me. So I was forced to re-install boot2docker itself (and as it turned out I had a very old version). You can do this via Homebrew or with the new installer (whereas, the solution demonstrated in the docker-docu doesn't work anymore). In any case, don't forget to set the DOCKER_HOST variable correct as explained in the documentation:
export DOCKER_HOST=tcp://127.0.0.1:4243
After re-installing boot2docker the following commands should work again:
./boot2docker init # fetches a brand new vm image and initializes
./boot2docker up # now we're back in business
That did it for me - now the performance is as expected
 docker run -i -t --rm dockerfile/ubuntu /bin/bash
gives me an (almost) instant bash-prompt.

Resources