lxc error Unable to fetch GPG key from keyserver

When i create an lxc container on the Ubuntu server, I get an error

root@instance-20210627-0830:~# lxc-create -t download -n ok
Setting up the GPG keyring
ERROR: Unable to fetch GPG key from keyserver
lxc-create: ok: lxccontainer.c: create_run_template: 1616 Failed to create container from template
lxc-create: ok: tools/lxc_create.c: main: 319 Failed to create container ok
root@instance-20210627-0830:~#

To fix this, you can run

export DOWNLOAD_KEYSERVER="keyserver.ubuntu.com"

To make it permanent, add it to .bashrc

vi ~/.bashrc

At the end of the file, add

export DOWNLOAD_KEYSERVER="keyserver.ubuntu.com"

Method 2

You can specify DOWNLOAD_KEYSERVER environment variable for the command with

DOWNLOAD_KEYSERVER="keyserver.ubuntu.com" lxc-create -t download -n mycontainer -- -d ubuntu -r focal -a amd64

Method 3

Use –keyserver command line argument

lxc-create -t download -n mycontainer -- -d ubuntu -r focal -a amd64 --keyserver hkp://keyserver.ubuntu.com

See lxc

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *