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