Hi Folks, When the host OS is Ubuntu 16.04 or RHEL 7.x, the following command is working, helping us to run systemctl commands on the host from within the docker container:
# nsenter --mount=/hostroot/proc/1/ns/mnt -- systemctl start dummy.service But in the newer host OS-es, Ubuntu 20.04 and RHEL 8.x, this doesn't work and we get the following error: # nsenter --mount=/hostroot/proc/1/ns/mnt -- systemctl start dummy.service Failed to connect to bus: No data available I have attached a minimalistic example and commands to run and reproduce the issue: Sample service which I wanted to start on the host, from the container: # cat /etc/systemd/system/dummy.service [Unit] Description=dummy service [Service] ExecStart=/usr/bin/sleep infinity Dockerfile of my container: # cat Dockerfile FROM ubuntu:20.04 ENV TZ=UTC RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt update -y --fix-missing RUN apt install -y util-linux STOPSIGNAL SIGRTMIN+3 CMD [ "/bin/bash" ] Build the image: # docker build -t trial . Delete any stale containers: # docker rm -f trial Run the image: # docker run -it -d --net=host --privileged -v /:/hostroot -v /sys/fs/cgroup:/sys/fs/cgroup:ro --name trial trial Reproduce the issue: # docker exec -it trial bash # nsenter --mount=/hostroot/proc/1/ns/mnt -- systemctl start dummy.service Failed to connect to bus: No data available I would like to know if there are any additional options or any docker run command that needs to be altered to get this working. Regards, Aravindhan Krishnan...
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel