Setup script fails while installing Docker: "because the public key is not available: NO_PUBKEY ..."
The installation fails on some systems. Oddly enough, it doesn't fail on DigitalOcean or GCP.
This is what the failure looks like:
$ sudo bash -c "$(wget -qO- https://raw.githubusercontent.com/Jigsaw-Code/outline-server/master/src/server_manager/install_scripts/install_server.sh)"
> Verifying that Docker is installed .......... NOT INSTALLED
> Would you like to install Docker? This will run 'curl https://get.docker.com/ | sh'. [Y/n]
> Installing Docker ........................... Docker installation failed, please visit https://docs.docker.com/install for instructions.
Last error: # Executing docker install script, commit: 93d2499759296ac1f9c510605fef85052a2c32be
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | gpg --dearmor --yes -o /usr/share/keyrings/docker-archive-keyring.gpg
gpg: WARNING: unsafe ownership on homedir '/home/fortuna/.gnupg'
+ sh -c echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu bionic stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
W: GPG error: https://download.docker.com/linux/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
E: The repository 'https://download.docker.com/linux/ubuntu bionic InRelease' is not signed.
Sorry! Something went wrong. If you can't figure this out, please copy and paste all this output into the Outline Manager screen, and send it to us, to see if we can help you.
Full log: /tmp/outline_logqBP
The file /usr/share/keyrings/docker-archive-keyring.gpg is created. However it seems apt-get can't read the key, resulting in failure, even though it's running as root (why??).
$ ls -l /usr/share/keyrings/docker-archive-keyring.gpg
-rw-rw---- 1 root root 2760 Jan 6 17:45 /usr/share/keyrings/docker-archive-keyring.gpg
$ sudo apt-get update -qq
W: GPG error: https://download.docker.com/linux/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
E: The repository 'https://download.docker.com/linux/ubuntu bionic InRelease' is not signed.
Changing the permission to a+r fixes the problem:
$ sudo chmod a+r /usr/share/keyrings/docker-archive-keyring.gpg
$ ls -l /usr/share/keyrings/docker-archive-keyring.gpg
-rw-rw-r-- 1 root root 2760 Jan 6 17:45 /usr/share/keyrings/docker-archive-keyring.gpg
$ sudo apt-get update -qq
$ (no errors)
Original complaint on Reddit: https://www.reddit.com/r/outlinevpn/comments/oxn9hx/cannot_install_outline_server_to_ubuntu_20042_lts/
It doesn't work on Ubuntu 18.04.4/5 either. I tried many ways to register Public key for docker repository or whatever, but eventually it does not work. It seems it is not the problem of Outline, though. Maybe fix will be out soon... hopefully.
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
This helped me install Docker on aws lightsail. And then, install Outline Server
We've investigated this a bit and believe it's an issue with the PGP key not getting updated in time. Our recommendation is to, as @IrishVoltik suggests, install Docker directly and run the script again.
curl -fsSL https://get.docker.com -o get-docker.shsudo sh get-docker.shThis helped me install Docker on aws lightsail. And then, install Outline Server
It doesn't work on Ubuntu 20.04 with aws lightsail or ec2.

curl -fsSL https://get.docker.com -o get-docker.shsudo sh get-docker.shThis helped me install Docker on aws lightsail. And then, install Outline ServerIt doesn't work on Ubuntu 20.04 with aws lightsail or ec2.
I guess this will work on 18 version of ubuntu.
It doesn't work on Ubuntu 20.04 with aws lightsail or ec2.
I also work with Ubuntu 20.04 and Lightsail instance. You can try do this with new clean Lightsail instance
It doesn't work on Ubuntu 20.04 with aws lightsail or ec2.
I also work with Ubuntu 20.04 and Lightsail instance. You can try do this with new clean Lightsail instance
I solved it by doing sudo apt-get install docker.io and it works like a charm.
@WarenGonzaga I has create another outline server with Digital Ocean, it very easy to create.
@WarenGonzaga I has create another outline server with Digital Ocean, it very easy to create.
I'm aware, I just want to use AWS.
I hear it may be an issue with the default umask, and that this can also fix the problem:
sudo chmod a+r /usr/share/keyrings/docker-archive-keyring.gpg
From https://stackoverflow.com/questions/60137344/docker-how-to-solve-the-public-key-error-in-ubuntu-while-installing-docker/68764068#68764068
/cc @bemasc
@fortuna solution fixed the issue
I fixed it by importing the key:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 7EA0A9C3F273FCD8
Fixed by https://github.com/Jigsaw-Code/outline-server/pull/1029