Skip to content

Instantly share code, notes, and snippets.

@yashodhank
Forked from vtrifonov-esfiddle/cloud-init.yaml
Created May 10, 2022 15:11
Show Gist options
  • Save yashodhank/f597646624d4c7d0004e4a9c576c1485 to your computer and use it in GitHub Desktop.
Save yashodhank/f597646624d4c7d0004e4a9c576c1485 to your computer and use it in GitHub Desktop.
cloud-init config for ubuntu host with docker & docker-compose
#cloud-config
groups:
- docker
users:
- default
# the docker service account
- name: docker-service
groups: docker
package_upgrade: true
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
runcmd:
# install docker following the guide: https://docs.docker.com/install/linux/docker-ce/ubuntu/
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo apt-get -y update
- sudo apt-get -y install docker-ce docker-ce-cli containerd.io
- sudo systemctl enable docker
# install docker-compose following the guide: https://docs.docker.com/compose/install/
- sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- sudo chmod +x /usr/local/bin/docker-compose
power_state:
mode: reboot
message: Restarting after installing docker & docker-compose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment