1

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.

  • 2
    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 Aug 24 '17 at 19:14
  • @Tensibai if Docker run will launch the process then can you tell me how to launch sshd service in Fedora container? – Buvanesh Kumar Aug 24 '17 at 19:18
  • 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 Aug 24 '17 at 19:20
  • 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 – Tensibai Aug 24 '17 at 19:22
  • @Tensibai it's not for a production environment. I'm just curious to know if there are any way to do it :) – Buvanesh Kumar Aug 24 '17 at 19:52
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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.