<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>

CC BY-SA 3.0
2017-09-05T04:32:43.473Z
2017-09-05T04:32:43.473Z
lakshayk
<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>

CC BY-SA 3.0
2017-08-24T19:14:20.940Z
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
Tensibai
CC BY-SA 3.0
2017-08-24T19:18:14.003Z
@Tensibai if Docker run will launch the process then can you tell me how to launch sshd service in Fedora container?
Buvanesh Kumar
CC BY-SA 3.0
2017-08-24T19:20:43.210Z
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?
Tensibai
CC BY-SA 3.0
2017-08-24T19:22:45.497Z
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
Tensibai
CC BY-SA 3.0
2017-08-24T19:52:44.683Z
@Tensibai it's not for a production environment. I'm just curious to know if there are any way to do it :)
Buvanesh Kumar
CC BY-SA 3.0
2017-08-30T09:38:31.093Z
@BuvaneshKumar, i can help you with enabling systemd inside the container, if you want. Not sure if that will be helpful.
lakshayk
CC BY-SA 3.0
2017-09-06T08:16:08.500Z
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.
Hauleth
<docker><dockerfile><containers>
How to start a service in fedora container without using systemd?
Buvanesh Kumar
# 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**: @BuvaneshKumar, 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/>


---

