lxc patch 5
This commit is contained in:
@@ -15,6 +15,11 @@ CONTAINER_IP="10.100.0.${NEXT_OCTET}"
|
||||
echo "Creating LXC container ${CONTAINER} (${CONTAINER_IP})..."
|
||||
lxc-create -n "$CONTAINER" -f /etc/lxc/default.conf -t download -- -d ubuntu -r noble -a amd64
|
||||
|
||||
# write resolv.conf into rootfs before boot
|
||||
mkdir -p "/var/lib/lxc/${CONTAINER}/rootfs/etc"
|
||||
rm -f "/var/lib/lxc/${CONTAINER}/rootfs/etc/resolv.conf" # remove if symlink
|
||||
echo "nameserver 8.8.8.8" > "/var/lib/lxc/${CONTAINER}/rootfs/etc/resolv.conf"
|
||||
|
||||
# assign static IP via LXC config (host-side, always works)
|
||||
cat >> "/var/lib/lxc/${CONTAINER}/config" <<EOF
|
||||
lxc.net.0.ipv4.address = ${CONTAINER_IP}/24
|
||||
@@ -23,10 +28,10 @@ lxc.start.auto = 1
|
||||
EOF
|
||||
|
||||
# write resolv.conf into rootfs before boot
|
||||
echo "nameserver 8.8.8.8" > "/var/lib/lxc/${CONTAINER}/rootfs/etc/resolv.conf"
|
||||
# echo "nameserver 8.8.8.8" > "/var/lib/lxc/${CONTAINER}/rootfs/etc/resolv.conf"
|
||||
|
||||
# disable any in-container networking that might fight us
|
||||
rm -f "/var/lib/lxc/${CONTAINER}/rootfs/etc/netplan/"*.yaml 2>/dev/null
|
||||
rm -f "/var/lib/lxc/${CONTAINER}/rootfs/etc/netplan/"*.yaml 2>/dev/null || true
|
||||
mkdir -p "/var/lib/lxc/${CONTAINER}/rootfs/etc/netplan"
|
||||
cat > "/var/lib/lxc/${CONTAINER}/rootfs/etc/netplan/10-lxc.yaml" <<EOF
|
||||
network:
|
||||
|
||||
Reference in New Issue
Block a user