systemd not working correctly in openSuSE Docker container on Ubuntu host

Hello,

I am able to run the openSuSE container opensuse/leap:42.3 from Docker Hub. I am using a Ubuntu 16.04 server as my host.

However, when installing software via zypper in the container, I am seeing occasional errors of the form:

     (38/42) Installing: policycoreutils-2.5-6.4.1.x86_64 .....................................................................................
     Additional rpm output:
     Failed to connect to bus: No such file or directory
     Created symlink from /etc/systemd/system/multi-user.target.wants/restorecond.service to /usr/lib/systemd/system/restorecond.service.

Looking around, it looks like this is related to systemd not being used as the default init service for the container. However, that seems to be wrong, since:

  1. /sbin/init is present and symlinked to systemd
  2. systemd appears to have been the default since SuSE 12.3
  3. Attempting to install systemd or systemd-sysvinit indicates that those packages are already initialized.

I also looked at other suggestions:

  • Running the container with /sbin/init as the entrypoint / default for CMD. That results in the container hanging completely.
         docker run -i -t --rm -m 4g -e container=docker opensuse/leap:42.3 /sbin/init
  • Mounting /run and /sys/fs/cgroups from host to container. No luck. Same problem as above.
         docker run -i -t --rm -m 4g -e container-docker -v /run -v /sys/fs/cgroup:/sys/fs/cgroup:ro ose /sbin/init

In both cases, the Docker daemon or container or host freezes with:

        !!!!!!] Failed to mount API filesystems, freezing.
        Freezing execution.

I am OK with ignoring the original error but it seems like this could cause other less obvious errors.

What should I do to fix this? I would prefer not to run the containers with SYS_ADMIN privileges or as a fully privileged container.

Other details:

Container:

5c652285b5a4:/ # uname -a
Linux 5c652285b5a4 4.13.0-39-generic #44~16.04.1-Ubuntu SMP Thu Apr 5 16:43:10 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Host:

cdpteam@cxtlxbld2:~$ uname -a
Linux cxtlxbld2 4.13.0-39-generic #44~16.04.1-Ubuntu SMP Thu Apr 5 16:43:10 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Thank you,

Docker Info:

cdpteam@cxtlxbld2:~$ docker info
Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 11
Server Version: 18.03.1-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: cc-runtime runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.13.0-39-generic
Operating System: Ubuntu 16.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.39GiB
Name: cxtlxbld2
ID: 44MA:AQXY:4ZTA:SMTC:U6SD:RWRR:YMRX:N2W3:BNMI:SKIV:JBX2:YVYN
Docker Root Dir: /z/d
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 26
 Goroutines: 37
 System Time: 2018-08-01T18:01:11.407778634Z
 EventsListeners: 0
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Docker Version:

Client:
 Version:      18.03.1-ce
 API version:  1.37
 Go version:   go1.9.5
 Git commit:   9ee9f40
 Built:        Thu Apr 26 07:17:20 2018
 OS/Arch:      linux/amd64
 Experimental: false
 Orchestrator: swarm


Server:
 Engine:
  Version:      18.03.1-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.5
  Git commit:   9ee9f40
  Built:        Thu Apr 26 07:15:30 2018
  OS/Arch:      linux/amd64
  Experimental: true

Vijai.

I assume you are trying to install applications like core-utils by running zypper in a shell within the container.

Although that might work, that shouldn’t be your SOP,
Instead you should create a Docker file.
A Docker file is how you take a generic image from Dockerhub and customize it to make it your own.

A brief Wiki article I wrote about this

https://en.opensuse.org/User:Tsu2/docker-build-tutorial-1

Aside from that,
You should also generally post the Docker image you use (and, BTW when you create your Docker file, don’t forget to include a “zypper up” command for the usual reasons).

As for your error, I’d wonder first if it’s not already part of some Dockerhub image… It might not be in a JeOS, but would expect it’d be in one of the more normal images. So again, you need to identify which image you’re running.

TSU