title: How to run docker command in this Airflow docker container?
body: <p>I have set up Airflow with docker-compose as described here.
  <a href="https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html" rel="nofollow noreferrer">https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html</a></p>
  <p>And there is a airflow task that have to execute docker command like</p>
  <pre><code>BashOperator(
      task_id='my',
      bash_command=&quot;&quot;&quot;
          docker run ..............
      &quot;&quot;&quot;,
      dag=dag,
  )
  </code></pre>
  <p>This means Docker package required <a href="https://github.com/apache/airflow/blob/master/Dockerfile" rel="nofollow noreferrer">in the airflow docker image, but there is not</a>.</p>
  <p>So, I tried to build my own <code>airflow image based docker installed image</code>. like,</p>
  <pre><code>FROM apache/airflow:2.0.1 as airflow-image
  SHELL [&quot;/bin/bash&quot;, &quot;-o&quot;, &quot;pipefail&quot;, &quot;-e&quot;, &quot;-u&quot;, &quot;-x&quot;, &quot;-c&quot;]
  
  USER root
  RUN apt-get update &amp;&amp; apt-get --assume-yes install \
      apt-transport-https \
      ca-certificates \
      curl \
      gnupg \
      lsb-release
  RUN curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  RUN echo $(lsb_release -cs)
  RUN echo \
    &quot;deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
    $(lsb_release -cs) stable&quot; | sudo tee /etc/apt/sources.list.d/docker.list &gt; /dev/null
  RUN apt-get update
  RUN apt-get --assume-yes install docker-ce docker-ce-cli containerd.io
  </code></pre>
  <p>With an image of above Dockerfile, docker is installed like,</p>
  <pre><code>$ whereis docker
  docker: /usr/bin/docker /usr/libexec/docker
  $ whereis dockerd
  dockerd: /usr/bin/dockerd
  </code></pre>
  <p>But I can not make docker daemon started so that task of airflow can execute <code>docker run</code> command.</p>
  <p>After I see this ENTRYPOINT and tested several things,
  <a href="https://github.com/apache/airflow/blob/master/Dockerfile#L535" rel="nofollow noreferrer">https://github.com/apache/airflow/blob/master/Dockerfile#L535</a></p>
  <pre><code>ENTRYPOINT [&quot;/usr/bin/dumb-init&quot;, &quot;--&quot;, &quot;/entrypoint&quot;]
  </code></pre>
  <p>I wonder whether I can start docker daemon or not.</p>
  <p>Any advice?
  Can I make an docker image which is based airflow:2.0.1 and support docker commans?</p>