###############################
# Get Docker + Docker-Compose #
###############################
-apt-get update
-apt-get install -y -q apt-transport-https vim
+# Check for updates only once per boot.
+dpkg-query -W docker-ce docker-compose &>/dev/null || rm -f /tmp/apt_run_this_boot
-wget -q "https://download.docker.com/linux/debian/gpg" -O - | apt-key add
-echo "deb https://download.docker.com/linux/debian stretch stable" > /etc/apt/sources.list.d/docker_com.list
+if [ ! -f /tmp/apt_run_this_boot ]; then
+ apt-get update
+ apt-get install -y -q apt-transport-https vim
-apt-get update
-apt-get install -y -q docker-ce docker-compose
+ wget -q "https://download.docker.com/linux/debian/gpg" -O - | apt-key add
+ echo "deb https://download.docker.com/linux/debian stretch stable" > /etc/apt/sources.list.d/docker_com.list
+
+ apt-get update
+ apt-get install -y -q docker-ce docker-compose
+
+ date -Isec > /tmp/apt_run_this_boot
+fi
#############################
# remove running containers #