Error "readlink /var/lib/docker/overlay2/l: invalid argument" - windows

I'm getting this error when executing docker run --rm -it alpine /bin/sh:
latest: Pulling from library/alpine
8921db27df28: Already exists
Digest: sha256:f271e74b17ced29b915d351685fd4644785c6d1559dd1f2d4189a5e851ef753a
Status: Downloaded newer image for alpine:latest
ERRO[0040] error waiting for container: context canceled
docker: Error response from daemon: Failed to inspect container 9919d1156d3960b46bca915bdf3b1d2320f463edbea5c39cacdc8b29640534fe: Error response from daemon: readlink /var/lib/docker/overlay2/l: invalid argument.
I'm using Docker Desktop on Windows with WSL 2.
I've tried docker rmi alpine:latest, but the error persisted.
I've tried docker system prune --all, but it didn't help.

Some of workarounds I've used:
When using the Docker command line, I specified a different version
of the image. Instead of alpine:latest, I used alpine:3.16, and it
helped.
I used Hyper-V instead of WSL 2 (Docker Desktop → Settings → General. Untick "Use the WSL 2 based engine")
As suggested in this answer, I reset Docker WSL 2 data. But
instead of resetting all Docker data, it is possible to clear only
WSL 2: Docker Desktop → Troubleshoot (it is the "bug" icon next to
the Settings icon) → Clean/Purge data, select WSL 2, and press Delete.

Related

failed to shutdown container in docker:

when im trying to build an image with command docker build im getting this error
im using windows docker desktop
The command '/bin/sh -c yarn install --production' returned a non-zero code: 4294967295: failed to shutdown container: container 1842716825b498d7be9ed514a4839dfc528caafe8f906018c93842517f60635e encountered an error during hcsshim::System::waitBackground: failure in a Windows system call: The virtual machine or container with the specified identifier is not running. (0xc0370110): subsequent terminate failed container 1842716825b498d7be9ed514a4839dfc528caafe8f906018c93842517f60635e encountered an error during hcsshim::System::waitBackground: failure in a Windows system call: The virtual machine or container with the specified identifier is not running. (0xc0370110)
how this error be resolved
This must be due to windows host failure on docker call when try to shut down the container
Try by restarting docker demon
sudo service docker restart
Check the status of the Docker containers:
docker ps -a
stop and remove it:
docker stop <container-id>
docker rm <container-id>
Then try by building the image again. If the problem still persists, consider upgrading to the latest version of Docker or clear docker cache or
docker system prune

docker system df - Error response from daemon

I am using Docker 3.3.1 on macOS Big Sur 11.3.
I get the following error message:
docker system df
> Error response from daemon: error getting build cache usage:
> failed to get usage for bm9...za9: stat
> /var/lib/docker/overlay2/r6y...dma: no such file or directory
What does not show anything is:
docker ps --all
What does not work, is:
docker-compose down
docker image prune
docker system prune -a
docker rmi {all images}
What can I do?
What solved it at the end was:
Open Docker dashboard
Select Clean / Purge data
Restart Docker (if not automatically done)

Docker on Win10 - is it possible to have multiple terminals?

I am new to Docker - installed DockerToolbox on Win10. And managed to run some basic docker examples. But I cannot seem to figure out how to access same container from multiple command line windows.
Quick online search suggested finding container ID (e.g. 2c7e29b9b666) via
docker ps
then running (I presume in new command window)
docker exec -it 2c7e29b9b666 bash
but that does not work in Win10.
Error message received is:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Edit: in the first window I started docker machine via:
docker-machine create --driver virtualbox tombox
and I can see 'tombox' in second window if I do:
docker-machine ls
Do I need to somehow reference 'tombox' when running docker commands in second window?

docker deamon is not work in windows

I try to run docker in bash ubuntu on windows. But every time I get this message
"Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?". If i run it in powershell - it work. Can somebody help?
Connecting to the docker deamon requires some privilidges that you don't have when starting the bash terminal.
You can however use the docker command terminal which will allow you to interact with the docker deamon.
Found the solution on this post: https://blog.jayway.com/2017/04/19/running-docker-on-bash-on-windows/
Connect Docker on WSL to Docker on Windows
Running docker against an engine on a different machine is actually quite easy, as Docker can expose a TCP endpoint which the CLI can attach to.
This TCP endpoint is turned off by default; to activate it, right-click the Docker icon in your taskbar and choose Settings, and tick the box next to “Expose daemon on tcp://localhost:2375 without TLS”.
With that done, all we need to do is instruct the CLI under Bash to connect to the engine running under Windows instead of to the non-existing engine running under Bash, like this:
$ docker -H tcp://0.0.0.0:2375 images
REPOSITORY TAG IMAGE ID CREATED SIZE
There are two ways to make this permanent – either add an alias for the above command, or better yet, export an environment variable which instructs Docker where to find the host engine:
$ echo "export DOCKER_HOST='tcp://0.0.0.0:2375'" >> ~/.bashrc
$ source ~/.bashrc
Now, running docker commands from Bash works just like they’re supposed to.
$ docker run hello-world
Hello from Docker!This message shows that your installation appears to be working correctly.

Docker complaining about ALL_PROXY environment variable with "proxy: unknown scheme: http"

I'm facing the following issue with my Docker containers: When I try to enter the container using
docker exec -it container-id /bin/bash
Docker (I assume it's Docker) complains with the following message:
proxy: unknown scheme: http
I have traced this back to the following environment variable that's set on my host machine, since I'm using a proxy server to access the web:
ALL_PROXY=http://myproxy:8080
The error message seems to come from the net/proxy.go file, which can be found here - the error message is issued on the last line of the file. Why would http not be a registered URL scheme in the Docker case?
As soon as I unset ALL_PROXY on the host, I can enter the container without any issues.
Environment:
Mac OS X v10.11.5
Docker v1.11.1
Docker-Machine v0.7.0
Any idea how to fix this (other than unsetting the variable each time)?
I am facing the same issue with docker 1.11.2. I believe the error is coming from method FromURL.
After checking the relevant commit https://github.com/docker/docker/commit/16effc66c028a7800096ed92174ca4bceba229ad, it turns out from v1.11.0-rc1 up to v1.12.0-rc4 are including this commit.
So the solution for me is to install a lower version (I used v1.10.3) of docker toolbox, after which "docker run hello-world" works.

Resources