Reinstall docker-ce after a purge and config dir deleted.

I purged the docker-ce package and deleted the /etc/docker directory and It brings me trouble... I cannot reinstall it. Every time I try to reinstall with the following command:

sudo apt install --reinstall docker-ce

...
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for detail
s.
invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/docker.service.d
           └─docker.conf
   Active: activating (auto-restart) (Result: exit-code) since 토 2018-02-17 22:54:41 KST; 5ms ago
     Docs: https://docs.docker.com
  Process: 28307 ExecStart=/usr/bin/dockerd --config-file=/etc/docker/daemon.json (code=exited, status=1/FAILURE)
 Main PID: 28307 (code=exited, status=1/FAILURE)

 2월 17 22:54:41 anda-stack systemd[1]: Failed to start Docker Application Container Engine.
 2월 17 22:54:41 anda-stack systemd[1]: docker.service: Unit entered failed state.
 2월 17 22:54:41 anda-stack systemd[1]: docker.service: Failed with result 'exit-code'.
dpkg: error processing package docker-ce (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)
...

Then I used this trying to recover the configuration files (look into /var/cache/apt/archives/ for the deb package):

sudo dpkg --force-confmiss -i /var/cache/apt/archives/docker-ce_17.12.0\~ce-0\~ubuntu_amd64.deb

I saw some of the configuration files were created but the same error above still shown up. Then, I noticed there is no /etc/docker/daemon.json. So, I created that file with the below content:

{
  "debug": true
}

I ran the above dpkg command again and everything was fine.



Comments