I am creating a recipe to install docker on Ubuntu 14.
How do I translate the command above to chef?}
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
So using apt-repository resource:
apt_repository "???" do
uri ???
distribution ???
components ???
keyserver "hkp://p80.pool.sks-keyservers.net:80"
key "58118E89F3A912897C070ADBF76221572C52609D"
end
In contrast to @kaboom, I would recommend the (more modern) apt cookbook maintained by Chef, which also allows to set up repos. The syntax is basically the same.
This is, how I install Docker (on Debian):
apt_repository "docker" do
uri "https://download.docker.com/linux/ubuntu"
distribution "#{node['lsb']['codename']}"
components ["stable"]
key "https://download.docker.com/linux/ubuntu/gpg"
end
EDIT: This is also available in Chef core without any cookbook as of 12.9.
EDIT2: Of course, you can also supply the keyserver and key_id parameters, if you want to specify it as such.
EDIT3: Correct docker URI and Key as of 2023-05-21
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With