0

I have setup a docker container based on OpenSuse 12, installed some additional files and copied some installer binaries into the container. So far everything fine.

From inside a running image of the container I now need to run the aforementioned setup program but this needs to have uuid.socket up and running - uuid.socket in turn needs systemctl to work correctly and this causes an error like this:

hxehost:/usr/sap/SRCFiles # systemctl
Failed to get D-Bus connection: Unknown error -1

I started the docker container like this:

docker run -h hxehost -i -t f3096b0aa964 /bin/bash

Which, according to some postings should start a machine container as opposed to an application container.

Can anyone tell me what I'm doing wrong here??? How do I get systemctl to work inside a docker container?

I tried to starte the container with this command, which according to linked hints should do, but to no avail

docker run --privileged --rm -ti -e 'container=docker' -h hxehost --network="bridge" --tmpfs /run --tmpfs /tmp -v /sys/fs/cgroup:/sys/fs/cgroup:ro siliconchris/hxe:v0.0.2 /bin/bash

If I do this, systemctl still gives exact same error.

If I start /sbin/init instead of /bin/bash, I can see that quite a lot of services are started (some, like wicked, login and module, fail). In the end, the container presents me with a login. After login, I can now execute systemctl and it shows all services with their respective states.

Now my next question is: IS THIS APPROACH FEASIBLE AT ALL???

Best regards,

Chris

You may find the repo to this image at SAP HANA Express Edition inside docker

siliconchris
  • 613
  • 2
  • 9
  • 22
  • see https://github.com/docker/docker/issues/7459 and https://github.com/docker/docker/pull/25567 – user2915097 Nov 10 '16 at 13:40
  • Hey user2915097, thanks for your answer. Unfortunately I'm probably too noob on docker to follow along as I don't get it. The linked entries talk about running the container in a specific way, which I did like so: docker run --privileged --rm -ti -e 'container=docker' -h hxehost --network="bridge" --tmpfs /run --tmpfs /tmp -v /sys/fs/cgroup:/sys/fs/cgroup:ro siliconchris/hxe:v0.0.2 bin/bash Now this doesn't solve the issue. Still systemctl fails with exact same error. I will update my question text accordingly – siliconchris Nov 11 '16 at 08:59

1 Answers1

0

Most current Linux systems depend on SystemD running, and systemctl will send requests to it. However most applications did install easily when I replaced the systemctl binary with a script that just interprets start/stop/status/enable commands. As another benefit, it would not need anymore those complicated startup-commands for the resulting image to get the systemd mapped into the container. May be that would help you? Please have a look at the docker-systemctl-replacement.

Guido U. Draheim
  • 3,038
  • 1
  • 20
  • 19