Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
$ sudo apt-get update
$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common \
    qemu-user-static

Add repository(When using the apt-key command)

Note

The apt-key command is scheduled to be discontinued, although the date has not yet been determined. Please try the method that does not use the apt-key command described below. The method for adding a repository is just one example, so please consider alternative methods on your own.

Add apt repository for Ubuntu provided by Docker to your system.

Add Docker official PGP key to your system.

Code Block
languagebash
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
Note
The apt-key command is scheduled to be deprecated. The abolishment date has not yet been determined, but please consider alternative methods on your own.
Info

Use -x option if you need a proxy server to connect to the Internet.

(Change URL and port number for the proxy server according to the proxy server you are using.)

$ curl -x http://proxy.example.com:8080/ -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Make sure the fingerprint looks like the following after adding PGP key.

Code Block
languagebash
$ sudo apt-key fingerprint 0EBFCD88
pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid           [ unknown ] Docker Release (CE deb) docker@docker.com
sub   rsa4096 2017-02-22 [S]

Then, add Docker official apt repository to your system.

Code Block
languagebash
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Info

Add environment variable “http_proxy” and “https_proxy” as indicated below if you need a proxy server to connect to the Internet.

(Change URL and port number for the proxy server according to the proxy server you are using.)

$ sudo http_proxy=http://proxy.example.com:8080 https_proxy=https://proxy.example.com:8080 add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Check if you successfully added apt repository to “/etc/apt/sources.list”.

Code Block
languagebash
$ cat /etc/apt/sources.list
(Omitted)
deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
# deb-src [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable

...