Docker Community Forums

Share and learn in the Docker community.

Trouble reinstalling docker after accidently removing /var/lib/docker


(Qomanaut) #1

Hello,

I wanted to use docker instead of cross-compiling for a LEGO mindstorm project. I followed the install instructions which ran smoothly. The hello world script run as supposed to be. Then, I went on with the Linux postinstallation steps. When doing step “Use a different storage engine”, I was asked to change /etc/docker/daemon.json and because this did not deliver the wanted result, I was asked to edit docker.service. This file was empty and I included the suggested lines. Now docker did not run at all and after changing the file again and again, I was not able to get it working. So, I reinstalled docker. The hello script did not work. I then decided to delete /var/lib/docker and go through the whole installation again. It always created an empty /var/lib/docker folder, but I could not start docker again. Stupid as I am, I did not make a backup of the /var/lib/docker folder. And now I am stuck with a non working version on my Fedora machine, although knowing it seemed to work fine before tempering with the docker.service.

Does anyone know how to completely remove docker and build it completely from scratch?

When restarting the docker.service, I get the following error:
Job for docker.service failed because the control process exited with error code.
See “systemctl status docker.service” and “journalctl -xe” for details.

when running systemctl status docker.service, I get:

● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/docker.service.d
└─override.conf
Active: failed (Result: exit-code) since Sun 2018-03-04 16:03:42 CET; 5min ago
Docs: https://docs.docker.com
Process: 6037 ExecStart=/usr/bin/dockerd (code=exited, status=1/FAILURE)
Main PID: 6037 (code=exited, status=1/FAILURE)
CPU: 17ms

Mar 04 16:03:42 brain systemd[1]: docker.service: Unit entered failed state.
Mar 04 16:03:42 brain systemd[1]: docker.service: Failed with result ‘exit-code’.
Mar 04 16:03:42 brain systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Mar 04 16:03:42 brain systemd[1]: Stopped Docker Application Container Engine.
Mar 04 16:03:42 brain systemd[1]: docker.service: Start request repeated too quickly.
Mar 04 16:03:42 brain systemd[1]: Failed to start Docker Application Container Engine.
Mar 04 16:03:42 brain systemd[1]: docker.service: Unit entered failed state.
Mar 04 16:03:42 brain systemd[1]: docker.service: Failed with result ‘exit-code’.

journalctl -xe delivers
– Defined-By: systemd
– Support:

– Unit docker.service has failed.

– The result is failed.
Mar 04 16:03:42 brain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:
Mar 04 16:03:42 brain systemd[1]: docker.service: Unit entered failed state.
Mar 04 16:03:42 brain systemd[1]: docker.service: Failed with result ‘exit-code’.
Mar 04 16:03:42 brain systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Mar 04 16:03:42 brain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:
Mar 04 16:03:42 brain audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:s
Mar 04 16:03:42 brain systemd[1]: Stopped Docker Application Container Engine.
– Subject: Unit docker.service has finished shutting down
– Defined-By: systemd
– Support:

– Unit docker.service has finished shutting down.
Mar 04 16:03:42 brain systemd[1]: Starting Docker Application Container Engine…
– Subject: Unit docker.service has begun start-up
– Defined-By: systemd
– Support:

– Unit docker.service has begun starting up.
Mar 04 16:03:42 brain dockerd[6037]: no sockets found via socket activation: make sure the service was
Mar 04 16:03:42 brain systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Mar 04 16:03:42 brain systemd[1]: Failed to start Docker Application Container Engine.
– Subject: Unit docker.service has failed
– Defined-By: systemd
– Support:

– Unit docker.service has failed.

– The result is failed.
Mar 04 16:03:42 brain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:
Mar 04 16:03:42 brain systemd[1]: docker.service: Unit entered failed state.
Mar 04 16:03:42 brain systemd[1]: docker.service: Failed with result ‘exit-code’.
Mar 04 16:03:42 brain systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Mar 04 16:03:42 brain systemd[1]: Stopped Docker Application Container Engine.
– Subject: Unit docker.service has finished shutting down
– Defined-By: systemd
– Support:

– Unit docker.service has finished shutting down.
Mar 04 16:03:42 brain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:
Mar 04 16:03:42 brain audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:s
Mar 04 16:03:42 brain systemd[1]: docker.service: Start request repeated too quickly.
Mar 04 16:03:42 brain systemd[1]: Failed to start Docker Application Container Engine.
– Subject: Unit docker.service has failed
– Defined-By: systemd
– Support:

– Unit docker.service has failed.

– The result is failed.
Mar 04 16:03:42 brain systemd[1]: docker.service: Unit entered failed state.
Mar 04 16:03:42 brain systemd[1]: docker.service: Failed with result ‘exit-code’.
Mar 04 16:03:56 brain PackageKit[2212]: get-updates transaction /2929_dadbbadb from uid 1000 finished w
Mar 04 16:04:38 brain dbus-daemon[1889]: [session uid=1000 pid=1889] Failed to activate service 'org.fr


(Qomanaut) #2

Sovled the problem by creating a new docker.socket file on my system (/lib/systemd/system/docker.socket) with the following content:

[Unit]
Description=Docker Socket for the API
PartOf=docker.service

[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker

[Install]
WantedBy=sockets.target

After that it again worked.