[systemd-devel] sibling DNS lookup of nspawn containers

2021-06-17 Thread Johannes Ernst
I’d like to be able to DNS lookup container b from within container a, if both 
were started with systemd-nspawn as siblings of each other, and shown as a and 
b in machinectl list.

man nss-mymachines specifically notes it won’t do that.

What’s the proper way of doing this?

Thanks,




Johannes.

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Unable to run systemctl commands on the host from the container which was working till Ubuntu 16.04

2021-06-17 Thread Aravindhan Krishnan
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