Skip to content

Docker System has not been booted with systemd as init system #24

Description

@igor-ivanov

In current configuration containers are loaded in systemV.
Issues:

  1. So it is problematic to use them to check systemD services
  2. type systemctl command does not help to verify current used init system
  3. In addition sudo is not available to use

For example:
[root@6092eda35ebd hpcx]# systemctl
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
[root@6092eda35ebd hpcx]# type systemctl
systemctl is hashed (/usr/bin/systemctl)
[root@6092eda35ebd hpcx]# echo $?
0

Description:
https://developers.redhat.com/blog/2014/05/05/running-systemd-within-docker-container/

Workaround:
Use --privileged

sudo docker run -it --privileged harbor.mellanox.com/swx-infra/x86_64/fedora31/builder:mofed-5.1-1.0.7.0 bash

As a result:
[root@f6c7f293ee20 hpcx]# type systemctl
systemctl is /usr/bin/systemctl
[root@f6c7f293ee20 hpcx]# sudo ls

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions