Skip to content

Instantly share code, notes, and snippets.

@osidney
Created October 10, 2019 23:31
Show Gist options
  • Save osidney/5e1fcf55571b22ac1415680e1f625557 to your computer and use it in GitHub Desktop.
Save osidney/5e1fcf55571b22ac1415680e1f625557 to your computer and use it in GitHub Desktop.
Cloud Init Docker
#cloud-config
users:
- name: cloudrocket
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh-authorized-keys:
- YOUR_PUB_KEY
- name: root
ssh-authorized-keys:
- YOUR_PUB_KEY
runcmd:
- sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin no/' /etc/ssh/sshd_config
- sed -i -e '/^PasswordAuthentication/s/^.*$/PasswordAuthentication no/' /etc/ssh/sshd_config
- sed -i -e '$aAllowUsers mj' /etc/ssh/sshd_config
- restart ssh
- sudo apt-get remove docker docker-engine docker.io containerd runc
- sudo apt-get update
- sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo apt-key fingerprint 0EBFCD88c
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo apt-get update
- sudo apt-get install docker-ce docker-ce-cli containerd.io -y
- sudo usermod -a -G docker mj
- sudo systemctl enable docker
- sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment