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:
- C:/ProgramData/DockerDesktop/vm-data on Windows
- For Details see_ https://www.kindacode.com/article/docker-desktop-change-images-containers-directory/
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"
Fix
- 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.
- For Details read: https://ethereum-blockchain-developer.com/250-docker-and-compose/04-docker-shared-host-filesystem/
- Shared Windows directory is d:\t
- Type: bind
- docker volume doesn’t show any volumes data
- To show the mounts run: docker inspect CONTAINER_ID | jq –raw-output .[].Mounts
$ 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”
Links
- https://superuser.com/questions/1697576/docker-desktop-for-windows-gui-is-not-starting
- https://stackoverflow.com/questions/70069941/docker-volume-bind-mount-access-is-denied
- https://www.kindacode.com/article/docker-desktop-change-images-containers-directory/
- https://deploy-preview-12877–docsdocker.netlify.app/docker-for-windows/mounts-on-windows/
Be First to Comment