systemd-nspawn -D /mnt/rootfs --bind-ro /etc/resolv.conf

Category: Administration

systemd-nspawn -D /mnt/rootfs --bind-ro /etc/resolv.conf

Run a container with read-only bind mounts

Boots /mnt/rootfs as a container while mounting /etc/resolv.conf from the host into it read-only, giving the container working DNS without letting it modify the file. --bind-ro makes the bind mount read-only, while plain --bind allows writes. Useful for networking in test containers.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.