Problem
I want to install Docker CE on a Debian Stretch system using Fully Automatic Installation (FAI). The official Docker documentation recommends that you install Docker using their package repository. I'm not sure how do this with FAI.
Docker Installation Instructions
The given instructions for installing Docker are as follows.
- Install packages to allow
apt
to use a repository over HTTPS:
sudo apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
- Add Docker's official GPG key to APT:
curl \
-fsSL \
https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg \
| sudo apt-key add -
- Add the Docker repository to APT:
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable"
- Update the APT package index:
sudo apt-get update
- Install the
docker-ce
package:
sudo apt-get install docker-ce
Solution Attempt
I decided to create an FAI class called DOCKER
for this installation.
First I create the following hook for the DOCKER
class (/srv/fai/config/hooks/repository.DOCKER
):
#!/bin/bash
# Install required packages for `add-apt-repository` utility
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
# Add the Docker repository
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable"
Next I download the Docker repository public key and placed it in the FAI package configuration directory at the following path:
/srv/fai/config/package_config/DOCKER.asc
Then I create the following package configuration file for the DOCKER
class (/srv/fai/config/package_config/DOCKER
):
# Install Docker CE (Community Edition)
PACKAGES install
docker-ce
Finally I perform a dirinstall/chroot installation using the DOCKER
class:
sudo fai \
--verbose \
--cfdir '/etc/fai' \
--class 'FAIBASE DEBIAN STRETCH DOCKER' \
--cspace 'file:///srv/fai/config' \
dirinstall 'docker'
Then I enter the chroot environment to check whether or not the installation was successful:
sudo chroot docker
Unfortunately when I check for docker
it does not appear to be installed:
root@faiserver:/# which docker root@faiserver:/# dpkg -l | grep -i docker
Checking the log files for evidence of the docker-ce
package yields the following:
root@faiserver:/# grep -Fir docker-ce /var/log/fai/faiserver/last/fai.log WARNING: These unknown packages are removed from the installation list: docker-ce
I also look for evidence that the add-apt-repository
command was executed, but don't find any:
root@faiserver:/# grep -Firl add-apt /var/log/fai root@faiserver:/#
However I am able to verify that the key was added to APT successfully:
root@faiserver:/# apt-key list 2>/dev/null | grep -i -B2 -A1 docker pub rsa4096 2017-02-22 [SCEA] 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 uid [ unknown] Docker Release (CE deb) <[email protected]> sub rsa4096 2017-02-22 [S]