title: Sub-process /usr/bin/dpkg returned an error code (1) when installing docker-ce on Ubuntu 16.04
body: <p>I try to prepare Ubuntu 16.04 automatically via script for installing <a href="https://rancher.com/docs/rancher/v2.x/en/installation/requirements/" rel="nofollow noreferrer">Rancher</a>, which requires 17.03.2 as latest Docker version:</p>
  
  <pre><code> default: Setting up docker-ce (17.03.2~ce-0~ubuntu-xenial) ...
      default: Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
      default: invoke-rc.d: initscript docker, action "start" failed.
      default: ● docker.service - Docker Application Container Engine
      default:    Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
      default:    Active: failed (Result: exit-code) since Tue 2018-11-13 17:25:47 UTC; 6ms ago
      default:      Docs: https://docs.docker.com
      default:   Process: 4162 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
      default:  Main PID: 4162 (code=exited, status=1/FAILURE)
      default: Nov 13 17:25:47 ubuntu-xenial systemd[1]: Starting Docker Application Contai....
      default: Nov 13 17:25:47 ubuntu-xenial dockerd[4162]: no sockets found via socket act...d
      default: Nov 13 17:25:47 ubuntu-xenial systemd[1]: docker.service: Main process exite...E
      default: Nov 13 17:25:47 ubuntu-xenial systemd[1]: Failed to start Docker Application....
      default: Nov 13 17:25:47 ubuntu-xenial systemd[1]: docker.service: Unit entered faile....
      default: Nov 13 17:25:47 ubuntu-xenial systemd[1]: docker.service: Failed with result....
      default: Hint: Some lines were ellipsized, use -l to show in full.
      default: dpkg: error processing package docker-ce (--configure):
      default:  subprocess installed post-installation script returned error exit status 1
      default: Processing triggers for libc-bin (2.23-0ubuntu10) ...
      default: Processing triggers for systemd (229-4ubuntu21.8) ...
      default: Processing triggers for ureadahead (0.100.0-19) ...
      default: Errors were encountered while processing:
      default:  docker-ce
      default: E: Sub-process /usr/bin/dpkg returned an error code (1)
  </code></pre>
  
  <p>My script according to the <a href="https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository" rel="nofollow noreferrer">Docker docs</a>:</p>
  
  <pre><code>apt-get update
  apt-get upgrade -y
  apt-get remove -y docker docker-engine docker.io
  
  apt-get install \
      apt-transport-https \
      ca-certificates \
      curl \
      software-properties-common
  curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
  add-apt-repository \
     "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
     $(lsb_release -cs) \
     stable"
  
  apt-get update
  apt-get install -y docker-ce=17.03.2~ce-0~ubuntu-xenial
  </code></pre>
  
  <p>It seems that Docker itself is working since I can e.g. call <code>docker --version</code> after starting the daemon with <code>service docker start</code>. But I doesn't know why those errors occurs. </p>
  
  <h3>Vagrantfile</h3>
  
  <pre><code># -*- mode: ruby -*-
  # vi: set ft=ruby :
  
  Vagrant.configure("2") do |config|
    config.vm.box = "ubuntu/xenial64"
  
     config.vm.provision "shell", path: "scripts/dependencies.sh"
  end
  </code></pre>
  
  <p>I'm using Vagrant with <code>vagrant up --provision</code>. Before starting, the old machine was deleted using <code>vagrant destroy</code> to make sure that the problems are not caused by some older runs of the script. The version is <code>16.04.5 LTS</code>. The <code>systemctl</code> and <code>journalctl</code> commands gave me a very long output, that doesn't seem to have more information about the problem like</p>
  
  <blockquote>
    <p>default: Nov 13 17:41:19 ubuntu-xenial systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE</p>
  </blockquote>
  
  <p>Even more strange that I don't get the error when running <code>vagrant ssh</code> and executing all the commands hand by hand. </p>