Answers: <p>Running systemd inside the container should not be required as docker run eventually does the same thing. Make changes in your run scripts to make them independant from systemd.
  If you still insist on using systemd and do not care about how docker works, there is a way to let systemd work inside the container. Follow this link:</p>
  
  <p><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>
  
Answers: CC BY-SA 3.0
Answers: 2017-09-05T04:32:43.473Z
Answers: 2017-09-05T04:32:43.473Z
Answers: lakshayk
Body: <p>I want to start a service in my fedora docker container. 
  But since systemd is not working in the fedora container. I am unable to start the service. I'm getting following error.</p>
  
  <blockquote>
    <p>Failed to connect to bus: No such file or directory</p>
  </blockquote>
  
  <p>In Ubuntu container, I am able to start any service using /etc/init.d/. 
  I want to know any other way to do the same for my fedora container.</p>
  
Comments: CC BY-SA 3.0
Comments: 2017-08-24T19:14:20.940Z
Comments: Init.d script just launch a process, docker run launch a process, so init.d scripts are not used, you just start the daemon as the script would do on the docker run command line
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-08-24T19:18:14.003Z
Comments: @Tensibai if Docker run will launch the process then can you tell me how to launch sshd service in Fedora container?
Comments: Buvanesh Kumar
Comments: CC BY-SA 3.0
Comments: 2017-08-24T19:20:43.210Z
Comments: From vacuum like this, no. I'd have to have a look at what the init.d script pass as argument, but why on earth would you need a ssh server within a container?
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-08-24T19:22:45.497Z
Comments: Using system d as main process allow to run multiple process in the same container, which is a counter pattern in term of isolation and should be done only when you understand why it should not be done
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-08-24T19:52:44.683Z
Comments: @Tensibai it's not for a production environment. I'm just curious to know if there are any way to do it :)
Comments: Buvanesh Kumar
Comments: CC BY-SA 3.0
Comments: 2017-08-30T09:38:31.093Z
Comments: @BuvaneshKumar, i can help you with enabling systemd inside the container, if you want. Not sure if that will be helpful.
Comments: lakshayk
Comments: CC BY-SA 3.0
Comments: 2017-09-06T08:16:08.500Z
Comments: In case as you have described I would think about using LXC instead of Docker. Docker containers by design should run one thing and one thing only.
Comments: Hauleth
Tags: <docker><dockerfile><containers>
Title: How to start a service in fedora container without using systemd?
UserDisplayName: Buvanesh Kumar
ThreadText: # How to start a service in fedora container without using systemd?
  
  (Asked by: username_0 on 2017-08-24)
  
  I want to start a service in my fedora docker container.
  But since systemd is not working in the fedora container. I am unable to start the service. I'm getting following error.
  
  > Failed to connect to bus: No such file or directory
  
  In Ubuntu container, I am able to start any service using /etc/init.d/.
  I want to know any other way to do the same for my fedora container.
  
  **Tags:** docker, dockerfile, containers
  
  > **Comments:**
  > **username_1**: Init.d script just launch a process, docker run launch a process, so init.d scripts are not used, you just start the daemon as the script would do on the docker run command line  
  > **username_0**: @username_1 if Docker run will launch the process then can you tell me how to launch sshd service in Fedora container?  
  > **username_1**: From vacuum like this, no. I'd have to have a look at what the init.d script pass as argument, but why on earth would you need a ssh server within a container?  
  > **username_1**: Using system d as main process allow to run multiple process in the same container, which is a counter pattern in term of isolation and should be done only when you understand why it should not be done  
  > **username_0**: @username_1 it's not for a production environment. I'm just curious to know if there are any way to do it :)  
  > **username_2**: @username_0, i can help you with enabling systemd inside the container, if you want. Not sure if that will be helpful.  
  > **username_3**: In case as you have described I would think about using LXC instead of Docker. Docker containers by design should run one thing and one thing only.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-09-05. Score: 1
  
  Running systemd inside the container should not be required as docker run eventually does the same thing. Make changes in your run scripts to make them independant from systemd.
  If you still insist on using systemd and do not care about how docker works, there is a way to let systemd work inside the container. Follow this link:
  
  <https://developers.redhat.com/blog/2014/05/05/running-systemd-within-docker-container/>
  
  
  ---
  
  