Problem scenario
You want to remove Docker from your Ubuntu server. You tried this command:
sudo apt-get remove docker
But you see this:
"
...
Active: failed (Result: exit-code) since Sun 2017-08-06 21:59:11 EDT; 11ms ago
Docs: https://docs.docker.com
Process: 21981 ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTS (code=exited, status=1/FAILURE)
Main PID: 21981 (code=exited, status=1/FAILURE)
Memory: 14.0M
CGroup: /system.slice/docker.service
Aug 06 21:59:10 server1 systemd[1]: Starting Docker Application Container E.....
Aug 06 21:59:10 server1 dockerd[21981]: time="2017-08-06T21:59:10.966158765-..."
Aug 06 21:59:11 server1 dockerd[21981]: time="2017-08-06T21:59:11.969170376-..."
Aug 06 21:59:11 server1 systemd[1]: docker.service: Main process exited, co...RE
Aug 06 21:59:11 server1 systemd[1]: Failed to start Docker Application Cont...e.
Aug 06 21:59:11 server1 systemd[1]: docker.service: Unit entered failed state.
Aug 06 21:59:11 server1 systemd[1]: docker.service: Failed with result 'exi...'.
Hint: Some lines were ellipsized, use -l to show in full.
dpkg: error processing package docker.io (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
docker.io
E: Sub-process /usr/bin/dpkg returned an error code (1)
"
The same result happens if you try to remove docker-engine. You want to completely remove Docker from your Linux OS.
How do you remove Docker from an Ubuntu Linux server when you get an error such as "Errors were encountered while processing: docker.io E: Sub-process /usr/bin/dpkg returned an error code (1)"?
Solution
#1 Run this command: sudo rm -rf /usr/bin/docker /etc/docker /usr/share/docker.io
#2 Reboot the server.
#3 Run these commands:
sudo rm -rf /lib/systemd/system/docker.service
sudo rm -rf /usr/share/man/man1/docker.1.gz