title: how to install/start docker engine service inside a docker container
body: <p>I am running jenkins off of the official docker container for jenkins. And i have the following <code>dockerfile</code> following the instructions at <a href="https://docs.docker.com/engine/installation/linux/debian/" rel="nofollow noreferrer">https://docs.docker.com/engine/installation/linux/debian/</a></p>
  
  <pre><code>FROM jenkins:2.32.1
  
  # install docker inside this container
  USER root
      # Install Docker inside Jenkins
      RUN apt-get update
      RUN apt-get purge "docker.io*"
      RUN apt-get update
      RUN apt-get install -y apt-transport-https ca-certificates gnupg2
      RUN apt-key adv \
         --keyserver hkp://ha.pool.sks-keyservers.net:80 \
         --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
      RUN echo "deb https://apt.dockerproject.org/repo debian-jessie main" &gt; /etc/apt/sources.list.d/docker.list
      RUN apt-get update
      RUN apt-cache policy docker-engine
      RUN apt-get update
      RUN apt-get install -y docker-engine
      RUN gpasswd -a jenkins docker
      USER jenkins
  </code></pre>
  
  <p>Then i perform the following:</p>
  
  <ul>
  <li>build an image from this dockerfile</li>
  <li>run a container from the image</li>
  <li>execute bash in the container as <strong><em>root user</em></strong></li>
  <li>run <code>sudo docker service start</code> in bash inside the container</li>
  </ul>
  
  <p>Here is what i get:</p>
  
  <pre><code>root@1e0f4b325d58:/# sudo service docker start
  mount: permission denied
  rmdir: failed to remove ‘cpu’: Read-only file system
  mount: permission denied
  rmdir: failed to remove ‘cpuacct’: Read-only file system
  mount: permission denied
  rmdir: failed to remove ‘net_cls’: Read-only file system
  mount: permission denied
  rmdir: failed to remove ‘net_prio’: Read-only file system
  /etc/init.d/docker: 96: ulimit: error setting limit (Operation not permitted)
  </code></pre>