title: Run a container that starts a systemd service
body: <p>I am trying to create a Jenkins image that will have Jenkins up running with all plugins installed skipping the installation wizard.</p>
  
  <p>I am stuck in the last bit. When I try to start jenkins (last instruction of my Dockerfile) using "systemctl start jenkins" I got the followoing error:</p>
  
  <pre><code>docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"systemctl start jenkins\": executable file not found in $PATH": unknown.
  </code></pre>
  
  <p>After checking <a href="https://developers.redhat.com/blog/2019/04/24/how-to-run-systemd-in-a-container/" rel="nofollow noreferrer">https://developers.redhat.com/blog/2019/04/24/how-to-run-systemd-in-a-container/</a> and 
  <a href="https://developers.redhat.com/blog/2014/05/05/running-systemd-within-docker-container/" rel="nofollow noreferrer">https://developers.redhat.com/blog/2014/05/05/running-systemd-within-docker-container/</a></p>
  
  <p>I tried with :</p>
  
  <p><code>ENTRYPOINT:["/sbin/init"]</code></p>
  
  <p>The result was:</p>
  
  <pre><code>a container was running but the service was not up.
  
  [manuel@master useCaseJenkins]$ docker container run --name jenkins -d -p 8081:8080 manrodri/jenkins_use_case
  2272206cdb8ce9483adfdaf4cbba5299c7d337dbe1b1e96e99a19821abd328e4
  </code></pre>
  
  <pre><code>$ docker container ls 
  CONTAINER ID        IMAGE                       COMMAND             CREATED             STATUS              PORTS                    NAMES
  2272206cdb8c        manrodri/jenkins_use_case   "/sbin/init"        37 seconds ago      Up 36 seconds       0.0.0.0:8081-&gt;8080/tcp   jenkins
  
  [manuel@master useCaseJenkins]$ curl http://localhost:8081
  curl: (56) Recv failure: Connection reset by peer
  </code></pre>
  
  <p>the container logs don't show anything at all.</p>
  
  <pre><code>[manuel@master useCaseJenkins]$ docker container logs 2272206cdb8c
  [manuel@master useCaseJenkins]$ 
  
  </code></pre>
  
  <p>I tried to run a simple httpd service in the same way as shown in the two sites I mentioned before with the same result. the container was running but nothing was up in port 80.</p>
  
  <p>See my Dockerfile at <a href="https://github.com/manrodri/jenkinsUseCase/blob/master/Dockerfile" rel="nofollow noreferrer">https://github.com/manrodri/jenkinsUseCase/blob/master/Dockerfile</a></p>