Description of problem: Running sshd on a fresh docker fedora image fails with this error: Failed to get D-Bus connection: No connection to service manager. Version-Release number of selected component (if applicable): $ docker -v Docker version 0.8.0, build cc3a8c8/0.8.0 $ docker inspect fedora [{ "id": "58394af373423902a1b97f209a31e3777932d9321ef10e64feaaa7b4df609cf9", "parent": "8abc22fbb04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db", "created": "2014-02-03T16:10:40.500814677Z", "container": "f718f19a28a5147da49313c54620306243734bafa63c76942ef6f8c4b4113bc5", "container_config": { "Hostname": "88807319f25e", "Domainname": "", "User": "", "Memory": 0, "MemorySwap": 0, "CpuShares": 0, "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "PortSpecs": null, "ExposedPorts": null, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "HOME=/", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "Cmd": [ "/bin/sh", "-c", "#(nop) ADD fedora-20-medium.tar.xz in /" ], "Dns": null, "Image": "8abc22fbb04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db", "Volumes": null, "VolumesFrom": "", "WorkingDir": "", "Entrypoint": null, "NetworkDisabled": false, "OnBuild": null }, "docker_version": "0.6.3", "author": "Lokesh Mandvekar \u003clsm5\u003e - ./buildcontainers.sh", "config": { "Hostname": "88807319f25e", "Domainname": "", "User": "", "Memory": 0, "MemorySwap": 0, "CpuShares": 0, "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "PortSpecs": null, "ExposedPorts": null, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "HOME=/", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "Cmd": null, "Dns": null, "Image": "8abc22fbb04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db", "Volumes": null, "VolumesFrom": "", "WorkingDir": "", "Entrypoint": null, "NetworkDisabled": false, "OnBuild": null }, "architecture": "x86_64", "Size": 385520098 }] How reproducible: Always Steps to Reproduce: 1. docker run -t -i fedora bash 2. bash-4.2# yum install -y openssh-server 3. bash-4.2# systemctl start sshd Actual results: Failed to get D-Bus connection: No connection to service manager. bash-4.2# service sshd status Redirecting to /bin/systemctl status sshd.service Failed to get D-Bus connection: No connection to service manager. Expected results: A running sshd daemon Additional info:
It's not sshd that's not working -- it's that you're not running systemd. The process you're running in your container is "bash". That means any services normally started by systemd aren't there -- not to mention systemd itself. You *can* run "docker run systemd", but results are unpredictable at best right now. Work on polishing that is a perfectly interesting project for someone, but as far as I know no one is focusing on it. You could also run the container with sshd directly -- that should work.
Thanks Matt for the explanation. At that time I had bypassed the problem using Centos images that allow me to use service sshd start that keeps it simpler by my point of view.
(In reply to Paolo Antinori from comment #2) > Thanks Matt for the explanation. At that time I had bypassed the problem > using Centos images that allow me to use > > service sshd start > > that keeps it simpler by my point of view. So, that just runs '/etc/init.d/sshd start', which in turn runs /usr/sbin/sshd. There's nothing fundamentally different from just doing that directly (although the script does set up host keys if they don't exist).