fix: use NetworkManager for ubuntu netplan

The config was hardcoded to eth0 and google dns. This commit
uses NetworkManager instead, which is the default on Ubuntu
20.04 and 22.04.
This commit is contained in:
SubaruArai 2023-10-23 13:42:24 +07:00
parent 1934915ae8
commit 12bf002224
1 changed files with 3 additions and 10 deletions

View File

@ -32,18 +32,11 @@ RUN systemctl preset-all
{{ if eq .NetworkManager "netplan" }}
RUN apt install -y netplan.io
RUN mkdir -p /etc/netplan && printf '\
# Let NetworkManager manage all devices on this system\n\
network:\n\
version: 2\n\
renderer: networkd\n\
ethernets:\n\
eth0:\n\
dhcp4: true\n\
dhcp-identifier: mac\n\
nameservers:\n\
addresses:\n\
- 8.8.8.8\n\
- 8.8.4.4\n\
' > /etc/netplan/00-netcfg.yaml
renderer: NetworkManager\n\
' > /etc/netplan/01-network-manager-all.yaml
{{ else if eq .NetworkManager "ifupdown"}}
RUN if [ -z "$(apt-cache madison ifupdown-ng 2> /dev/nul)" ]; then apt install -y ifupdown; else apt install -y ifupdown-ng; fi
RUN mkdir -p /etc/network && printf '\