mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-21 18:24:49 +00:00
nm-in-container: disable handling of "/etc/resolv.conf" in container and use 8.8.8.8.
By default, podman bind mounts a "/etc/resolv.conf" file. That prevents NetworkManager (inside the container) to update the file, which leads to warnings in the log and certain NM-ci tests won't pass due to that. Disable handling of "/etc/resolv.conf" in podman. But also pre-deploy a default resolv.conf, with the google name server 8.8.8.8. I don't understand why, but even with "--dns=none", writing "/etc/resolv.conf" while building the container doesn't take effect. Instead, write a usable "/etc/resolv.conf" from "/etc/rc.d/rc.local".
This commit is contained in:
parent
c7675c73ee
commit
a6802cfa74
|
@ -1,3 +1,8 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
/usr/bin/_nm-in-container-setup.sh
|
||||
|
||||
cat <<EOF > /etc/resolv.conf
|
||||
# Generated by /etc/rc.d/rc.local
|
||||
nameserver 8.8.8.8
|
||||
EOF
|
||||
|
|
|
@ -83,6 +83,8 @@ do_setup() {
|
|||
--listen-address="192:168:$((120 + IDX))::1" \
|
||||
--dhcp-range="192.168.$((120 + $IDX)).100,192.168.$((120 + $IDX)).150,2m" \
|
||||
--dhcp-range="192:168:$((120 + IDX))::1:1000,192:168:$((120 + IDX))::1:2000,64,2m" \
|
||||
--dhcp-option=option:dns-server,8.8.8.8,8.8.4.4 \
|
||||
--dhcp-option=option6:dns-server \
|
||||
--no-ping \
|
||||
&
|
||||
|
||||
|
|
|
@ -497,6 +497,8 @@ RUN systemctl enable NetworkManager
|
|||
# Generate a stable machine id.
|
||||
RUN echo "10001000100010001000100010001000" > /etc/machine-id
|
||||
|
||||
RUN echo -e "# Default from the container image\nnameserver 8.8.8.8" > /etc/resolv.conf
|
||||
|
||||
# Generate a fixed (version 1) secret key.
|
||||
RUN mkdir -p /var/lib/NetworkManager
|
||||
RUN chmod 700 /var/lib/NetworkManager
|
||||
|
@ -569,6 +571,7 @@ do_run() {
|
|||
|
||||
podman run --privileged \
|
||||
--name "$CONTAINER_NAME_NAME" \
|
||||
--dns=none \
|
||||
-d \
|
||||
-v "$BASEDIR_NM:$BASEDIR_NM" \
|
||||
"${BIND_NM_CI[@]}" \
|
||||
|
|
Loading…
Reference in a new issue