<p>I am trying to run docker inside my container. I saw in some of the article that I need to pass  --privileged=true to make this possible.</p>

<p>But for some reason, I do not have the option to pass this parameter while running.. because it is been taken care by some automation which I do not have access.</p>

<p>So, I was wondering if its possible to pass above option in Dockerfile, so that I do not have the pass this as param.</p>

<p>Right now this is the content of my dockerfile.</p>

<pre><code>FROM my-repo/jenkinsci/jnlp-slave:2.62

USER root
#RUN --privileged=true this doesnt work for obvious reasons
MAINTAINER RD_TOOLS "abc@example.com"
RUN apt-get update
RUN apt-get remove docker docker-engine docker.io || echo "No worries"
RUN apt-get --assume-yes install \
     apt-transport-https \
     ca-certificates \
     curl \
     gnupg2 \
     software-properties-common curl
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
RUN apt-key fingerprint 0EBFCD88
RUN cat /etc/*-release
RUN apt-get --assume-yes install docker.io
RUN docker --version
RUN service docker start
</code></pre>

<p>WIthout passing privilaged= true param, it seems I cant run the docker inside docker.</p>

<p>Any help in this regard is highly appreciated.</p>

kaounKaoun
<p>You can't force a container to run as privileged from within the Dockerfile.</p>

<p>As a general rule, you can't run Docker inside a Docker container; the more typical setup is to share the host's Docker socket.  There's an official Docker image that attempts this at <a href="https://hub.docker.com/_/docker/" rel="nofollow noreferrer">https://hub.docker.com/_/docker/</a> with some fairly prominent suggestions to not actually use it.</p>
