Skip to content

Instantly share code, notes, and snippets.

@Xaerxess
Last active April 16, 2024 08:07
Show Gist options
  • Save Xaerxess/cf424e632e6028bf55ba5c635694ed42 to your computer and use it in GitHub Desktop.
Save Xaerxess/cf424e632e6028bf55ba5c635694ed42 to your computer and use it in GitHub Desktop.
cloud-init: docker + rancher
#cloud-config
apt:
sources:
docker.list:
source: deb [arch=amd64] https://download.docker.com/linux/ubuntu $RELEASE stable
keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
package_update: true
package_upgrade: true
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
- docker-ce
- docker-ce-cli
- containerd.io
# Enable ipv4 forwarding, required on CIS hardened machines
write_files:
- path: /etc/sysctl.d/enabled_ipv4_forwarding.conf
content: |
net.ipv4.conf.all.forwarding=1
- path: /etc/sysctl.d/k8s.conf
content: |
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
# create the docker group
groups:
- docker
# Add default auto created user to docker group
system_info:
default_user:
groups: [docker]
runcmd:
- docker run -d --restart=unless-stopped -p 80:80 -p 443:443 --privileged rancher/rancher:v2.8-head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment