Installing Packages (e.g. docker-ce) from a 3rd Party Repository

Itamar Gal itamarggal at gmail.com
Wed Feb 14 20:18:23 CET 2018


Dear FAI Users:

Here's the abridged version of my question: How do I add a 3rd party
package repository and then install software from it?

Now here's the longer version.

I want to install Docker CE (https://www.docker.com/community-edition) on a
Debian Stretch system using FAI. The official Docker documentation
recommends that you install Docker using their package repository (
https://docs.docker.com/install/linux/docker-ce/debian/#install-using-the-repository).
I'm not sure how do this with FAI.


The given instructions for installing Docker are as follows.

1. 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

2. 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 -

3. 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"

4. Update the APT package index:

    sudo apt-get update

5. Install the docker-ce package:

    sudo apt-get install docker-ce


Here is my 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 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 at faiserver:/# which docker
    root at faiserver:/# dpkg -l | grep -i docker

Checking the log files for evidence of the docker-ce package yields the
following:

    root at 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 at faiserver:/# grep -Firl add-apt-repository /var/log/fai
    root at faiserver:/#

However I am able to verify that the key was added to APT successfully:

    root at 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) <docker at docker.com>
    sub   rsa4096 2017-02-22 [S]


Any suggestions would be greatly appreciated.

Cheers,
Itamar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-koeln.de/pipermail/linux-fai/attachments/20180214/30ce1744/attachment.html>


More information about the linux-fai mailing list