diff --git a/Dockerfile b/Dockerfile
index 4e6c11e55e7f33966a9b66c66b3035ce7c29eea1..c28477197dd80bcf6403ab37b1d5889ccfed8cc6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM ruby:2.6-buster
+FROM ruby:2.6-bullseye
 
 # skip installing gem documentation
 RUN mkdir -p /usr/local/etc \
diff --git a/scripts/build-vm.sh b/scripts/build-vm.sh
index bed28316258ab8e7addb6a134c21a1e3e7873954..aafdefa249bf4f077ac9802ce0339669c9db7fe6 100755
--- a/scripts/build-vm.sh
+++ b/scripts/build-vm.sh
@@ -15,12 +15,12 @@ unzip -o packer_${PACKER_V}_linux_amd64.zip
 rm packer_${PACKER_V}_linux_amd64.zip
 
 # update json file with debian netinst image"
-SUMS=`curl -s http://cdimage.debian.org/cdimage/archive/10.11.0/amd64/iso-cd/SHA512SUMS | grep -E 'debian-[0-9]*.[0-9]*.[0-9]*-amd64-netinst.iso'`
+SUMS=`curl -s https://cdimage.debian.org/debian-cd/11.3.0/amd64/iso-cd/SHA512SUMS | grep -E 'debian-[0-9]*.[0-9]*.[0-9]*-amd64-netinst.iso'`
 SHA512=`echo $SUMS | awk '{print $1}'`
 ISO=`echo $SUMS | awk '{print $2}'`
 echo "ISO: $ISO"
 
-ISO_PATH="http://cdimage.debian.org/cdimage/archive/10.11.0/amd64/iso-cd/$ISO"
+ISO_PATH="https://cdimage.debian.org/debian-cd/11.3.0/amd64/iso-cd/$ISO"
 
 TEMPFILE=`mktemp`
 
diff --git a/vm-provisioning-main.sh b/vm-provisioning-main.sh
index a780c8127d68c679cd2b2b5bf04492b7dbbcdff0..a461426b3932103d8eec15c95ae4fb61d8ae491f 100755
--- a/vm-provisioning-main.sh
+++ b/vm-provisioning-main.sh
@@ -12,7 +12,7 @@ sudo apt-get -y upgrade
 
 
 echo "==> Installing things..."
-sudo apt-get install -y --no-install-recommends ipset autoconf build-essential dpkg-dev libssl-dev libyaml-dev libreadline6-dev linux-headers-$(uname -r) zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev liblzma-dev libpq-dev libsqlite3-dev git bison libgdbm-dev ruby postgresql postgresql-client vim zsh screen dnsutils dkms netcat redis-server unzip psmisc gawk tcpdump python3 python3-pip python3-venv python3-setuptools python python-pip python-setuptools gnupg2 aptitude libsystemd-dev msitools
+sudo apt-get install -y --no-install-recommends ipset autoconf build-essential dpkg-dev libssl-dev libyaml-dev libreadline6-dev linux-headers-$(uname -r) zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev liblzma-dev libpq-dev libsqlite3-dev git bison libgdbm-dev ruby postgresql postgresql-client vim zsh screen dnsutils dkms netcat redis-server unzip psmisc gawk tcpdump python3 python3-pip python3-venv python3-setuptools gnupg2 aptitude libsystemd-dev msitools
 
 
 echo "==> Building Ruby..."
@@ -53,20 +53,22 @@ echo 'export PATH="$BUNDLE_BIN:$PATH"' >> /home/ape/.bash_profile
 sudo gem update --system
 
 echo "==> Configuring Postgres..."
+POSTGRES_MAJOR="$(psql --version | cut -d' ' -f3 | cut -d'.' -f1)"
 sudo -u postgres psql -U postgres -d postgres -c "alter user postgres with password '1t54p3';"
-sudo sed 's/^local\s*all\s*postgres\s*peer$/local\tall\tpostgres\tmd5/' -i.orig /etc/postgresql/11/main/pg_hba.conf
-sudo sed -r 's/max_connections = 100/max_connections = 500/' -i.orig /etc/postgresql/11/main/postgresql.conf
+sudo sed 's/^local\s*all\s*postgres\s*peer$/local\tall\tpostgres\tmd5/' -i.orig "/etc/postgresql/$POSTGRES_MAJOR/main/pg_hba.conf"
+sudo sed -r 's/max_connections = 100/max_connections = 500/' -i.orig "/etc/postgresql/$POSTGRES_MAJOR/main/postgresql.conf"
 sudo systemctl restart postgresql.service
 PGPASSWORD=1t54p3 psql -U postgres -c "create user its with password 'ape';"
 PGPASSWORD=1t54p3 createdb -U postgres -e -E UTF8 -O its itsape
 
 
 echo "==> Installing Docker..."
-sudo apt-get install -y --no-install-recommends apt-transport-https ca-certificates curl software-properties-common
-curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
-sudo bash -c "echo 'deb [arch=amd64] https://download.docker.com/linux/debian \
-stretch \
-stable' > /etc/apt/sources.list.d/docker.list"
+sudo apt-get install -y --no-install-recommends ca-certificates curl gnupg lsb-release
+sudo mkdir -p /etc/apt/keyrings
+curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
+echo \
+  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
+  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
 sudo apt-get update
 sudo apt-get install -y --no-install-recommends docker-ce
 sudo usermod -a -G docker ape