Brief question: Docker, Ubuntu 16.04, auto-security-upgrades & reboot. Then how can I ensure the newest linux-image-extra-`uname -r` has been installed before Docker attempts to start the containers after an auto-security-upgrade-and-reboot?
Detailed question: (everything below)
I'm using Docker and Docker-Compose to deploy my web app. I've configured the Docker containers to start automatically on reboot. And, I've configured automatic security upgrades, including automatic restarts.
This means that every now and then, a new kernel gets automatically installed and the server reboots. After this, Docker will fail to start, because:
prior storage driver "aufs" failed: driver not supported
(says service docker start
). To solve this, one needs to:
sudo apt-get install linux-image-extra-`uname -r`
So I've added this to crontab:
root@edgoew1dal16gandi:~# crontab -l
...
@reboot apt-get install linux-image-extra-`uname -r` 2>&1 >> /tmp/cron-edm.log
But this fails because: (I see in the /tmp/cron-edm.log file)
Err:1 http://security.ubuntu.com/ubuntu xenial-security/main
amd64 linux-image-extra-4.4.0-24-generic amd64 4.4.0-24.43
Temporary failure resolving 'europe-west1.gce.archive.ubuntu.com'
However if I run the command manually after reboot, then it works. Apparently, apt-get
fails because it gets run too early after reboot?
Hence I'm wondering, how can I somehow do this:
apt-get install linux-image-extra-`uname -r`
automatically, after each server reboot, and before Docker starts, without this failing because of the above "Temporary failure ..." error?