Why does docker stop all containers after a while? - docker

We've installed Docker CE on Ubuntu 20.04 LTS, and it used to work as expected, but since recently, I've noticed that all running containers are stopped after a while (~ 1-2 days).
The very same containers show no problems on an Ubuntu 16.04 LTS installation, so I assume the problem lies within the OS or docker.
I've checked the docker log using
sudo journalctl -xu docker.service
but it shows me only the startup entries. There is no entry that would give a hint about why the containers have been stopped.
When I check the stopped containers using
docker ps -a
the status is: Exited (255) 36 hours ago
If I look at the container log using
docker logs <containername>
there is no problem or error reported either. The log simply ends. Only in our LDAP container, I see
613c0916 daemon: shutdown requested and initiated.
613c0916 slapd shutdown: waiting for 0 operations/tasks to finish
*** Killing all processes...
I've searched the internet for possible causes and found reports about an OS update problem in https://forums.docker.com/t/mysterious-docker-engine-shutdown/101193 and https://bugs.launchpad.net/ubuntu/+source/containerd/+bug/1870514
I've updated Ubuntu using
sudo apt update && sudo apt upgrade -y
but the problem continues to happen.
How can I find out what is going on?
Version info:
Client: Docker Engine - Community
Version: 20.10.8
API version: 1.40
Go version: go1.16.6
Git commit: 3967b7d
Built: Fri Jul 30 19:54:27 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 19.03.13
API version: 1.40 (minimum version 1.12)
Go version: go1.13.15
Git commit: bd33bbf
Built: Fri Feb 5 15:58:24 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.3.7
GitCommit: 8fba4e9a7d01810a393d5d25a3621dc101981175
runc:
Version: 1.0.0-rc10
GitCommit:
docker-init:
Version: 0.18.0
GitCommit: fec3683

Turned out that the update would simply not cure the problem.
I had to turn off the auto-update feature:
$ sudo dpkg-reconfigure unattended-upgrades
After that, I also removed the snap install of Docker, and re-installed it the "old-fashioned" way according to the Docker installation docs because of the problem described here.

Related

Docker pull throwing EOF exceptions

I recently installed Docker on my setup from https://docs.docker.com/desktop/install/mac-install/. When I try to pull any image in my terminal, it throws following error:
(base) harshgoyal#lawn-128-61-61-143 ~ % docker pull docker/getting-started
Using default tag: latest
Error response from daemon: Get "https://registry-1.docker.io/v2/": EOF
(base) harshgoyal#lawn-128-61-61-143 ~ %
(base) harshgoyal#lawn-128-61-61-143 ~ % docker version
Client: Docker Engine - Community
Version: 20.10.23
API version: 1.41
Go version: go1.19.5
Git commit: 715524332f
Built: Wed Jan 18 20:42:16 2023
OS/Arch: darwin/arm64
Context: default
Experimental: true
Server: Docker Desktop 4.16.2 (95914)
Engine:
Version: 20.10.22
API version: 1.41 (minimum version 1.12)
Go version: go1.18.9
Git commit: 42c8b31
Built: Thu Dec 15 22:25:43 2022
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.6.14
GitCommit: 9ba4b250366a5ddde94bb7c9d1def331423aa323
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
(base) harshgoyal#lawn-128-61-61-143 ~ %
System: Macbook Air M1 silicon chip with MacOS Ventura
Solutions tried:
Restarting docker
Reinstalling docker after cleaning all cache files.
Nothing has helped yet. Could someone please help me debug this issue?
Please try to switch the network if you are facing this issue. It worked once I moved to personal hotspot. Seems my university network caused the problem.
Reference thread: https://forums.docker.com/t/docker-pull-throwing-eof-exceptions/134219

Unable to login to docker via Ubuntu 18.04.5 LTS

I am having an issue on login to docker from my Ubuntu 18.04.5 LTS
This is the command I run to login docker
sudo docker login -u myname -p mypass
This is the error I've got
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
I did searches on google and seems it is not quite a common issue to everyone.
This is my docker version
Client: Docker Engine - Community
Version: 19.03.12
API version: 1.40
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:45:36 2020
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.12
API version: 1.40 (minimum version 1.12)
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:44:07 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
Basically, there are what I have done so far:
run sudo docker run hello-world to verify that my docker is runner properly
Hello from Docker!
This message shows that your installation appears to be working correctly.
...
run sudo vi ~/.docker/config.json to add "HttpHeaders
{
"auths": {},
"HttpHeaders": {
"User-Agent": "Docker-Client/19.03.12 (linux)"
}
}
run sudo vi /etc/docker/daemon.json to add dns then reload daemon and restar docker
{
"dns": ["8.8.8.8","8.8.4.4" ]
}
run curl https://registry-1.docker.io/v2/ and sure enough I've got this
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}
As people were talking about proxy server, I also did a test run curl https://google.com aand get respons, does it mean that my server is not reside behind a proxy?
Unfortunately, after try several combinations of above solutions, I'm still not able to login to docker.
Does anyone has any advice?

Timeout exceeded when trying to pull hello-world image on wsl2 windows10

I install wsl2 (ubuntu 20.04) on my windows system and I am having troubles with docker. I am not able to run simple hello-world image because I get following error:
Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
I configured resolv.conf by adding nameserver 8.8.8.8 and 8.8.4.4 because I've read that this helped some people but it didn't work for me.
My version of docker:
Version: 20.10.9
API version: 1.41
Go version: go1.16.8
Git commit: c2ea9bc
Built: Mon Oct 4 16:08:29 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.9
API version: 1.41 (minimum version 1.12)
Go version: go1.16.8
Git commit: 79ea9d3
Built: Mon Oct 4 16:06:37 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.11
GitCommit: 5b46e404f6b9f661a205e28d59c982d3634148f8
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0
I tried to restart docker - sudo service docker restart but it also didn't help.
I am out of ideas how to fix this. Can anybody help me with this issue?
This problem happend to me too.
I found this article helpful.
https://serverfault.com/questions/908141/docker-pull-tls-handshake-timeout
It provides temporary solution, like docker pull ${IMAGE} separately.
It helped me.
P.S. This error is not common, it may be caused from time to time, so don't spend too much time on it :)
I started getting this error on a Centos 7 server. The cause was wrong proxy settings: the network team of my company removed the need for a proxy and I checked that no HTTPS_PROXY env variable was set on the server but in my case the proxy setting for Docker was in /etc/systemd/system/docker.service.d/http-proxy.conf as described in this page.
BTW, I also tried updating Docker but yum didn't work either: it has its own proxy settings in /etc/yum.conf.

Docker Hello-world fails with "no such file or directory"

OS: Ubuntu cinammon 20.04
I followed the directions from here: docker documentation
When I get to the step to run the Hello-world image.
$ sudo docker run hello-world docker: Error response from daemon: open /var/lib/docker/aufs/layers/9cd449051217b6dc5c24c81e1a02ef897eeb90ee62421d6a227ddfbeddc2b70c-init: no such file or directory. See 'docker run --help'.
`
I've stopped and started the daemon.
sudo service docker stop sudo service docker start
and
systemctl restart docker
The image exists locally per:
$ sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest bf756fb1ae65 6 months ago 13.3kB
I've been Googling this and getting nowhere. I've seen other places where restarting the daemon fixes it, but I'm just not that lucky.
Any ideas??
More info:
$ sudo docker version
Client: Docker Engine - Community
Version: 19.03.12
API version: 1.40
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:45:44 2020
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.12
API version: 1.40 (minimum version 1.12)
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:44:15 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683

Docker cannot access any Internet URL during build

I have the following Dockerfile:
FROM mcr.microsoft.com/windows/servercore:ltsc2019
SHELL ["powershell", "-Command"]
RUN Invoke-WebRequest -UseBasicParsing http://www.google.com
On my Windows 10 machine, I run docker build . and get the following:
Basically, Docker is unable to access any Internet URL I try. I can run the same Dockerfile on my Windows Server 2019 Core machine and everything works fine. I'm running Docker version 18.09.2 and haven't updated it recently. This was working a few days ago, so it's a new issue. I've tried restarting the Docker engine and also rebooting. I've also tried a docker system prune. Any ideas what broke this? I'd rather not reinstall Docker if possible.
Docker Info:
Client: Docker Engine - Community
Version: 18.09.2
API version: 1.39
Go version: go1.10.8
Git commit: 6247962
Built: Sun Feb 10 04:12:31 2019
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.2
API version: 1.39 (minimum version 1.24)
Go version: go1.10.6
Git commit: 6247962
Built: Sun Feb 10 04:28:48 2019
OS/Arch: windows/amd64
Experimental: false
Update: Seems to be DNS related. I can ping things.
This is a known issue with ltsc2019 images (https://github.com/Azure/AKS/issues/1029). Put following at the start of your dockerfile or before entrypoint
Set-DnsClientServerAddress -InterfaceIndex (Get-NetAdapter).IfIndex -ServerAddresses ('8.8.8.8')

Resources