title: Dockerfile: bind9: unrecognized service
body: <p>I am new in docker, I want to build an image with Ubuntu 20.04 and bind9 service installation.</p>
  <p>below is my code of docker file</p>
  <pre><code>FROM ubuntu:20.04
  
  ENV TZ=Asia
  RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &amp;&amp; echo $TZ &gt; /etc/timezone
  
  RUN apt-get update &amp;&amp; apt-get install -y \
      apt-utils \
      systemctl \
      bind9     
  
  CMD [&quot;/usr/sbin/named&quot;, &quot;-g&quot;, &quot;-c&quot;, &quot;/etc/bind/named.conf&quot;, &quot;-u&quot;, &quot;bind&quot;]
  
  CMD systemctl restart bind9
  </code></pre>
  <p>When I execute following command to build an image,</p>
  <pre><code>sudo docker image build --tag bind9server . 
  </code></pre>
  <p>It works fine.</p>
  <pre><code>Step 6/6 : CMD systemctl restart bind9
   ---&gt; Running in f982f314c216
  </code></pre>
  <p>But when I run this docker image, I am getting an error like below</p>
  <pre><code>ERROR:systemctl:Unit bind9.service could not be found.
  </code></pre>
  <p>Can anyone help me, after installation of Bind9, why I am getting an error with above command?</p>
  <p>Error comes with Docker only, if I run same command in Host environment which is Ubuntu 20.04 then it works fine.</p>