Docker pull: `remove /.pivot_root347438920: device or resource busy` - docker

I'm trying to pull an image off GCR using docker, using:
docker pull eu.gcr.io/<project>/<image>:<tag>
However I keep getting the error:
failed to register layer: ApplyLayer exit status 1 stdout: stderr: Error cleaning up after pivot: remove /.pivot_root347438920: device or resource busy
After receiving the error all calls to docker returns:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
The output of systemctl status docker is:
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2020-08-18 10:38:26 CEST; 14min ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 985 (dockerd)
Tasks: 42
Memory: 175.0M
CGroup: /system.slice/docker.service
└─985 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Aug 18 10:38:25 <my_name> dockerd[985]: time="2020-08-18T10:38:25.329780734+02:00" level=info msg="Loading containers: start."
Aug 18 10:38:26 <my_name> dockerd[985]: time="2020-08-18T10:38:26.093178325+02:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
Aug 18 10:38:26 <my_name> dockerd[985]: time="2020-08-18T10:38:26.219186657+02:00" level=info msg="Loading containers: done."
Aug 18 10:38:26 <my_name> dockerd[985]: time="2020-08-18T10:38:26.333584778+02:00" level=info msg="Docker daemon" commit=48a66213fe graphdriver(s)=devicemapper version=19.03.12-ce
Aug 18 10:38:26 <my_name> dockerd[985]: time="2020-08-18T10:38:26.334733161+02:00" level=info msg="Daemon has completed initialization" Aug 18 10:38:26 emil-pc dockerd[985]: time="2020-08-18T10:38:26.389239911+02:00" level=info msg="API listen on /run/docker.sock"
Aug 18 10:38:26 <my_name> systemd[1]: Started Docker Application Container Engine.
Aug 18 10:46:05 <my_name> dockerd[985]: time="2020-08-18T10:46:05.342092783+02:00" level=info msg="Attempting next endpoint for pull after error: failed to register layer: ApplyLayer exit status 1 stdout: stderr: Error cleaning up after pivot: remove /.pivot_root557795275: device or resource busy"
I've tried restarting docker but to no avail. Any help is much appriciated.

Related

Intellij: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (Details: [2] No such file or directory)

I am trying to use docker compose with inellij but it does not connect. Here is the out of
sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2022-05-30 22:57:39 +04; 17min ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 3820 (dockerd)
Tasks: 27 (limit: 9308)
Memory: 53.9M
CPU: 3.267s
CGroup: /system.slice/docker.service
├─ 3820 /usr/bin/dockerd -H fd://
└─ 3832 containerd --config /var/run/docker/containerd/containerd.toml --log-level info
May 30 22:57:39 albert-80nv dockerd[3820]: time="2022-05-30T22:57:39.578835983+04:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///v>
May 30 22:57:39 albert-80nv dockerd[3820]: time="2022-05-30T22:57:39.578850600+04:00" level=info msg="ClientConn switching balancer to \"pick_first\"" modu>
May 30 22:57:39 albert-80nv dockerd[3820]: time="2022-05-30T22:57:39.580713487+04:00" level=info msg="[graphdriver] using prior storage driver: btrfs"
May 30 22:57:39 albert-80nv dockerd[3820]: time="2022-05-30T22:57:39.584726242+04:00" level=info msg="Loading containers: start."
May 30 22:57:39 albert-80nv dockerd[3820]: time="2022-05-30T22:57:39.678110934+04:00" level=info msg="Default bridge (docker0) is assigned with an IP addre>
May 30 22:57:39 albert-80nv dockerd[3820]: time="2022-05-30T22:57:39.716490285+04:00" level=info msg="Loading containers: done."
May 30 22:57:39 albert-80nv dockerd[3820]: time="2022-05-30T22:57:39.725192175+04:00" level=info msg="Docker daemon" commit=f756502055 graphdriver(s)=btrfs>
May 30 22:57:39 albert-80nv dockerd[3820]: time="2022-05-30T22:57:39.725256842+04:00" level=info msg="Daemon has completed initialization"
May 30 22:57:39 albert-80nv systemd[1]: Started Docker Application Container Engine.
May 30 22:57:39 albert-80nv dockerd[3820]: time="2022-05-30T22:57:39.748038554+04:00" level=info msg="API listen on /run/docker.sock"
id
id=1000(albert) gid=1000(albert) groups=1000(albert),3(sys),90(network),98(power),961(docker),991(lp),998(wheel)
and
ps aux | grep docker
root 3820 0.0 0.5 1742604 46792 ? Ssl 22:57 0:00 /usr/bin/dockerd -H fd://
root 3832 0.2 0.3 1639784 30568 ? Ssl 22:57 0:03 containerd --config /var/run/docker/containerd/containerd.toml --log-level info
albert 5144 0.0 0.0 7012 2560 pts/1 S+ 23:21 0:00 grep --colour=auto docker
As you can see docker daemon is not among the running processes, but the docker. service is active and I am pretty sure all permissions have been set correctly. So what can I do here?

can't connect to docker daemon, tho it's started

I run
systemctl status docker
and get
docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2021-05-22 01:13:39 EDT; 2min 58s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 29937 (dockerd)
Tasks: 16
Memory: 44.2M
CGroup: /system.slice/docker.service
└─29937 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
May 22 01:13:38 mbfgdell dockerd[29937]: time="2021-05-22T01:13:38.546418221-04:00" level=warning msg="Your kernel>
May 22 01:13:38 mbfgdell dockerd[29937]: time="2021-05-22T01:13:38.546439612-04:00" level=warning msg="Your kernel>
May 22 01:13:38 mbfgdell dockerd[29937]: time="2021-05-22T01:13:38.546456513-04:00" level=warning msg="Your kernel>
May 22 01:13:38 mbfgdell dockerd[29937]: time="2021-05-22T01:13:38.546810704-04:00" level=info msg="Loading contai>
May 22 01:13:38 mbfgdell dockerd[29937]: time="2021-05-22T01:13:38.865868481-04:00" level=info msg="Default bridge>
May 22 01:13:39 mbfgdell dockerd[29937]: time="2021-05-22T01:13:39.027302568-04:00" level=info msg="Loading contai>
May 22 01:13:39 mbfgdell dockerd[29937]: time="2021-05-22T01:13:39.173496789-04:00" level=info msg="Docker daemon">
May 22 01:13:39 mbfgdell dockerd[29937]: time="2021-05-22T01:13:39.173625360-04:00" level=info msg="Daemon has com>
May 22 01:13:39 mbfgdell systemd[1]: Started Docker Application Container Engine.
May 22 01:13:39 mbfgdell dockerd[29937]: time="2021-05-22T01:13:39.258181088-04:00" level=info msg="API listen on >
but when i do
docker info
I get
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
scan: Docker Scan (Docker Inc., v0.7.0)
Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
Does anyone know what's wrong here?
(i do see a docker.pid in /var/run, however i do NOT see a docker.sock in /var/run)
After further discovery, the socket file is here
/run/docker.sock
not /var/run/docker.sock
the systemd unit file for docker.socket looks like
cat docker.socket
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker
[Install]
WantedBy=sockets.target
not sure if the daemon or the client is wrong, and how to fix it???
UPDATE: hmm it seems if i create a symlink from /var/run/docker.sock to /run/docker.sock it works. Not great, but i guess i'll live with it

Duplicate installation of docker from both iso and apt

question
A virtual machine of mine is ubuntu, docker is installed when install ubuntu from iso. After that, I installed again from apt, because previous one is not registered in "systemctl". Now , there is two space for both docker, just like following.
Two docker have their own space for "docker ps / image CMD" .
Reboot start with "SPACE docker A", and "systemctl status" works good. Once "systemctl restart", move to "SPACE docker B".
If I want remove "SPACE docker A". How can I do it? I would be very grateful if any suggestion is given.
For now, my workaround is manually systemctl restart every time.
appendix
root#wzhjworkmachine:~/gitRoot# echo "now I reboot"
now I reboot
root#wzhjworkmachine:~/gitRoot# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-08-24 04:12:19 UTC; 1min 10s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 941 (dockerd)
Tasks: 11
Memory: 118.5M
CGroup: /system.slice/docker.service
└─941 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Aug 24 04:12:19 wzhjworkmachine dockerd[941]: time="2020-08-24T04:12:19.395653457Z" level=warning msg="Your kernel does not support cgroup rt runtime"
Aug 24 04:12:19 wzhjworkmachine dockerd[941]: time="2020-08-24T04:12:19.395739427Z" level=warning msg="Your kernel does not support cgroup blkio weight"
Aug 24 04:12:19 wzhjworkmachine dockerd[941]: time="2020-08-24T04:12:19.395827870Z" level=warning msg="Your kernel does not support cgroup blkio weight_device"
Aug 24 04:12:19 wzhjworkmachine dockerd[941]: time="2020-08-24T04:12:19.396046259Z" level=info msg="Loading containers: start."
Aug 24 04:12:19 wzhjworkmachine dockerd[941]: time="2020-08-24T04:12:19.631892982Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option -->
Aug 24 04:12:19 wzhjworkmachine dockerd[941]: time="2020-08-24T04:12:19.666930410Z" level=info msg="Loading containers: done."
Aug 24 04:12:19 wzhjworkmachine dockerd[941]: time="2020-08-24T04:12:19.719311959Z" level=info msg="Docker daemon" commit=afacb8b7f0 graphdriver(s)=overlay2 version=19.03.8
Aug 24 04:12:19 wzhjworkmachine dockerd[941]: time="2020-08-24T04:12:19.720376021Z" level=info msg="Daemon has completed initialization"
Aug 24 04:12:19 wzhjworkmachine systemd[1]: Started Docker Application Container Engine.
Aug 24 04:12:19 wzhjworkmachine dockerd[941]: time="2020-08-24T04:12:19.752861257Z" level=info msg="API listen on /run/docker.sock"
root#wzhjworkmachine:~/gitRoot# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
root#wzhjworkmachine:~/gitRoot# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
wzhjv001 v1 0127641f0d76 2 days ago 867MB
hub.ark.jd.com/wzhj-compile-image4jenkins/quickcompile gov1.14 0127641f0d76 2 days ago 867MB
root#wzhjworkmachine:~/gitRoot# systemctl restart docker
root#wzhjworkmachine:~/gitRoot# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-08-24 04:13:45 UTC; 6s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 2103 (dockerd)
Tasks: 12
Memory: 38.4M
CGroup: /system.slice/docker.service
└─2103 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Aug 24 04:13:45 wzhjworkmachine dockerd[2103]: time="2020-08-24T04:13:45.183475793Z" level=warning msg="Your kernel does not support cgroup rt runtime"
Aug 24 04:13:45 wzhjworkmachine dockerd[2103]: time="2020-08-24T04:13:45.183480494Z" level=warning msg="Your kernel does not support cgroup blkio weight"
Aug 24 04:13:45 wzhjworkmachine dockerd[2103]: time="2020-08-24T04:13:45.183485240Z" level=warning msg="Your kernel does not support cgroup blkio weight_device"
Aug 24 04:13:45 wzhjworkmachine dockerd[2103]: time="2020-08-24T04:13:45.183615822Z" level=info msg="Loading containers: start."
Aug 24 04:13:45 wzhjworkmachine dockerd[2103]: time="2020-08-24T04:13:45.269534194Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option ->
Aug 24 04:13:45 wzhjworkmachine dockerd[2103]: time="2020-08-24T04:13:45.303140798Z" level=info msg="Loading containers: done."
Aug 24 04:13:45 wzhjworkmachine dockerd[2103]: time="2020-08-24T04:13:45.313875267Z" level=info msg="Docker daemon" commit=afacb8b7f0 graphdriver(s)=overlay2 version=19.03.8
Aug 24 04:13:45 wzhjworkmachine dockerd[2103]: time="2020-08-24T04:13:45.314078704Z" level=info msg="Daemon has completed initialization"
Aug 24 04:13:45 wzhjworkmachine dockerd[2103]: time="2020-08-24T04:13:45.326129124Z" level=info msg="API listen on /run/docker.sock"
Aug 24 04:13:45 wzhjworkmachine systemd[1]: Started Docker Application Container Engine.
root#wzhjworkmachine:~/gitRoot# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1d09c0866672 9f266d35e02c "/bin/bash" About a minute ago Exited (0) About a minute ago intelligent_rhodes
root#wzhjworkmachine:~/gitRoot# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
centos 7.4.1708 9f266d35e02c 17 months ago 197MB

How to to restart Docker service if it stuck?

I can't restart docker service. After command system just getting stuck.
docker service status is here:
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: deactivating (stop-sigterm)
Docs: https://docs.docker.com
Main PID: 1216 (dockerd)
Tasks: 9
CGroup: /system.slice/docker.service
└─1216 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Aug 25 15:08:21 hq-rproxy02 dockerd[1216]: time="2020-08-25T15:08:21.179342033-07:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=
Aug 25 15:08:21 hq-rproxy02 dockerd[1216]: time="2020-08-25T15:08:21.631714600-07:00" level=info msg="[graphdriver] using prior storage driver: overlay2"
Aug 25 15:08:23 hq-rproxy02 dockerd[1216]: time="2020-08-25T15:08:23.607526073-07:00" level=warning msg="Your kernel does not support swap memory limit"
Aug 25 15:08:23 hq-rproxy02 dockerd[1216]: time="2020-08-25T15:08:23.608984581-07:00" level=warning msg="Your kernel does not support cgroup rt period"
Aug 25 15:08:23 hq-rproxy02 dockerd[1216]: time="2020-08-25T15:08:23.609119466-07:00" level=warning msg="Your kernel does not support cgroup rt runtime"
Aug 25 15:08:23 hq-rproxy02 dockerd[1216]: time="2020-08-25T15:08:23.609435097-07:00" level=info msg="Loading containers: start."
Aug 25 15:08:32 hq-rproxy02 dockerd[1216]: time="2020-08-25T15:08:32.266035465-07:00" level=info msg="Removing stale sandbox f2295d6e0a7aec8569c42470bbccbc5a1
Aug 25 15:08:32 hq-rproxy02 dockerd[1216]: time="2020-08-25T15:08:32.677509372-07:00" level=warning msg="Error (Unable to complete atomic operation, key modif
Aug 25 15:08:33 hq-rproxy02 dockerd[1216]: time="2020-08-25T15:08:33.339048947-07:00" level=info msg="Default bridge (docker0) is assigned with an IP address
Aug 27 05:12:40 hq-rproxy02 dockerd[1216]: time="2020-08-27T05:12:40.330007214-07:00" level=info msg="Processing signal 'terminated'"
● docker.socket - Docker Socket for the API
Loaded: loaded (/lib/systemd/system/docker.socket; enabled; vendor preset: enabled)
Active: active (running) since Tue 2020-08-25 15:07:44 PDT; 5 days ago
Listen: /var/run/docker.sock (Stream)
Tasks: 0 (limit: 1113)
CGroup: /system.slice/docker.socket
Aug 25 15:07:44 hq-rproxy02 systemd[1]: Starting Docker Socket for the API.
Aug 25 15:07:44 hq-rproxy02 systemd[1]: Listening on Docker Socket for the API.
What can I check?

Unable to run docker-compose

Following this article on Jhipster, I build the project. I, however, can't run docker-compose. So, I try to figure out the problem. I walk step by step with this Docker-Compose article without luck.
$ sudo service docker status
docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2018-12-27 15:40:22 PST; 2 days ago
Docs: https://docs.docker.com
Main PID: 1960 (dockerd)
Tasks: 20 (limit: 4440)
Memory: 68.2M
CGroup: /system.slice/docker.service
├─1960 /usr/bin/dockerd -H fd://
└─2093 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --s
Dec 27 15:40:10 tk-PC dockerd[1960]: time="2018-12-27T15:40:10.493340278-08:00" level=warning msg="Your kernel does not support swap memory li
Dec 27 15:40:10 tk-PC dockerd[1960]: time="2018-12-27T15:40:10.493612101-08:00" level=warning msg="Your kernel does not support cgroup rt peri
Dec 27 15:40:10 tk-PC dockerd[1960]: time="2018-12-27T15:40:10.493681034-08:00" level=warning msg="Your kernel does not support cgroup rt runt
Dec 27 15:40:10 tk-PC dockerd[1960]: time="2018-12-27T15:40:10.496381656-08:00" level=info msg="Loading containers: start."
Dec 27 15:40:17 tk-PC dockerd[1960]: time="2018-12-27T15:40:17.498415923-08:00" level=info msg="Default bridge (docker0) is assigned with an I
Dec 27 15:40:19 tk-PC dockerd[1960]: time="2018-12-27T15:40:19.646853084-08:00" level=info msg="Loading containers: done."
Dec 27 15:40:22 tk-PC dockerd[1960]: time="2018-12-27T15:40:22.512083092-08:00" level=info msg="Daemon has completed initialization"
Dec 27 15:40:22 tk-PC dockerd[1960]: time="2018-12-27T15:40:22.512266914-08:00" level=info msg="Docker daemon" commit=89658be graphdriver=aufs
Dec 27 15:40:22 tk-PC dockerd[1960]: time="2018-12-27T15:40:22.553322342-08:00" level=info msg="API listen on /var/run/docker.sock"
Dec 27 15:40:22 tk-PC systemd[1]: Started Docker Application Container Engine.
$ sudo ls -la /var/run/docker.sock
srw-rw---- 1 root docker 0 Dec 27 15:39 /var/run/docker.sock
$ sudo usermod -aG docker ${USER}
$ docker-compose -f docker-compose.yml build --build-arg UID=$(id -u)
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
The result of the last step is the same as "docker-compose up -d". According to the article, it would be a permission problem if the problem still exists at this point. How can I find what permission issue?
There are multiple ways you can solve this problem. Firstly try to export environment variable of docker host with command:
export DOCKER_HOST=/var/run/docker.sock
If it works you can add the same line to your bashrc config to save this export permanently.
If it doesn't work you can try to modify docker daemon config. It located in
/etc/docker/daemon.json
You'll need to append the localhost to your hosts like that:
"hosts": ["old_hosts_not_modified_only_append_new_one", "tcp://localhost:2376"],
and restart docker daemon using command:
service docker restart
Hope it gonna help ya

Resources