I am trying to install docker on ubuntu and following installation guide I came across this command.
"curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -"
And in its responce I get OK and nothing really downloads. Am I suppose to provide a key or what is the purpose of this curl command.
The apt-key add
adds a trusted key to for the docker repository. The curl command is downloading this key and piping it to the apt-key add
command which adds it as a trusted key.
>man apt-key
COMMANDS
Add filename
Add a new key to the list of trusted keys. The key is read from the filename
given with the parameter filename or if the filename is - from standard
input.
It is critical that keys added manually via apt-key are verified to belong
to the owner of the repositories they claim to be for otherwise the apt-
secure(8) infrastructure is completely undermined.
In short, This command downloads the key as adds it as a trusted key.
I done this in a alternative way to make to understand !
1. stored key to a file
#curl -fsSL https://download.docker.com/linux/debian/gpg > key_stored2file
2. Add a new key to the list of trusted keys.
#apt-key add key_stored2file
OK
If -
given instead of filename( in above example key_stored2file
) then it will take from standard input so it can be run as a single command as follows
#curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.