Zum Inhalt springen

Docker Pitfalls on Windows

Space Problems on Drive C:

It seems that Docker Desktotp needs at least 8 Gbyte free space to start successfully on Windows . Without that space docker desktop doesn’t start until you delete/purge all your VMs.

Fix 1: Relocate vm-data directory

By default, Docker Desktop stores your images and containers at:

To change this Location goto Settings -> Resources and change Disk Image Location

Fix 2: Delete hiberfil.sys

Please check whether you can delete c:\hiberfil.sys . For details read:

  • https://www.howtogeek.com/howto/15140/what-is-hiberfil.sys-and-how-do-i-delete-it/

Create volume fails – No volume created at all

Simple docker command does not create a volume

$ docker run --rm -v /d/t:/myvol ubuntu /bin/bash -c "ls -lha > /myvol/myfile.txt"


  • Disable Use the WSL2 based engine
  • Press Apply & Restart Button

Testing volume creation after above fix

Let’s share some files from our host to our docker container. This is done with the “-v” flag and then “host-directory:container-directory” and is directly mapped into the container.

$ docker run --rm -v /d/t:/myvol ubuntu /bin/bash -c "ls -lha > /myvol/myfile.txt"

$ ls -l  d:/t/my*
-rw-r--r-- 1 Helmut None 1279 Aug 12 14:06 d:/t/myfile.txt

$ cat  d:/t/myfile.txt
total 60K
drwxr-xr-x   1 root root 4.0K Aug 12 12:06 .
drwxr-xr-x   1 root root 4.0K Aug 12 12:06 ..
-rwxr-xr-x   1 root root    0 Aug 12 12:06 .dockerenv
lrwxrwxrwx   1 root root    7 Aug  1 13:22 bin -> usr/bin
drwxr-xr-x   2 root root 4.0K Apr 18 10:28 boot
drwxr-xr-x   5 root root  340 Aug 12 12:06 dev

$ docker ps -a
CONTAINER ID   IMAGE                              COMMAND                  CREATED          STATUS                      PORTS                                            NAMES
37ee7d537f85   ubuntu                             "/bin/bash -c 'ls -l…"   23 minutes ago   Exited (0) 23 minutes ago                                                    laughing_herschel

$  docker inspect 37ee7d537f85  | jq --raw-output .[].Mounts
    "Type": "bind",
    "Source": "/d/t",
    "Destination": "/myvol",
    "Mode": "",
    "RW": true,
    "Propagation": "rprivate"
  • This command runs “ls -lha” and pipes the output to /myvol/myfile.txt
  • /myvol is “mounted” to the current working directory on the host
  • On the host you can observe a new file called “myfile.txt” with the output of “ls -lha”
  • The container is then ended and removed because of “–rm”


Published inAllgemein

Sei der Erste der einen Kommentar abgibt

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert