Update 'test/create_container.sh'
This commit is contained in:
parent
dbdb5572a7
commit
c8f581266a
@ -97,16 +97,15 @@ else
|
|||||||
"${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
"${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
info "Using '$STORAGE' for storage location."
|
|
||||||
|
|
||||||
# Get the next guest VM/LXC ID
|
# Get the next guest VM/LXC ID
|
||||||
CTID=$(pvesh get /cluster/nextid)
|
CTID=$(pvesh get /cluster/nextid)
|
||||||
info "Container ID is $CTID."
|
info "Container ID is $CTID."
|
||||||
|
|
||||||
# Download latest Debian 10 LXC template
|
# Download latest Debian 10 LXC template
|
||||||
msg "Updating LXC template list..."
|
#msg "Updating LXC template list..."
|
||||||
pveam update >/dev/null
|
pveam update >/dev/null
|
||||||
msg "Downloading LXC template..."
|
#msg "Downloading LXC template..."
|
||||||
OSTYPE=debian
|
OSTYPE=debian
|
||||||
OSVERSION=${OSTYPE}-11
|
OSVERSION=${OSTYPE}-11
|
||||||
mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V)
|
mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($OSVERSION.*\)/\1/p" | sort -t - -k 2 -V)
|
||||||
@ -130,7 +129,7 @@ DISK=${DISK_PREFIX:-vm}-${CTID}-disk-0${DISK_EXT-}
|
|||||||
ROOTFS=${STORAGE}:${DISK_REF-}${DISK}
|
ROOTFS=${STORAGE}:${DISK_REF-}${DISK}
|
||||||
|
|
||||||
# Create LXC
|
# Create LXC
|
||||||
msg "Creating LXC container..."
|
#msg "Creating LXC container..."
|
||||||
DISK_SIZE=4G
|
DISK_SIZE=4G
|
||||||
pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null
|
pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null
|
||||||
if [ "$STORAGE_TYPE" == "zfspool" ]; then
|
if [ "$STORAGE_TYPE" == "zfspool" ]; then
|
||||||
@ -161,7 +160,7 @@ ln -fs $(readlink /etc/localtime) ${MOUNT}/etc/localtime
|
|||||||
pct unmount $CTID && unset MOUNT
|
pct unmount $CTID && unset MOUNT
|
||||||
|
|
||||||
# Setup container
|
# Setup container
|
||||||
msg "Starting LXC container..."
|
#msg "Starting LXC container..."
|
||||||
pct start $CTID
|
pct start $CTID
|
||||||
pct push $CTID setup.sh /setup.sh -perms 755
|
pct push $CTID setup.sh /setup.sh -perms 755
|
||||||
pct push $CTID portainer_stack.yml /docker-compose.yml -perms 755
|
pct push $CTID portainer_stack.yml /docker-compose.yml -perms 755
|
||||||
|
Loading…
x
Reference in New Issue
Block a user