Fix cloud-init daemon.json

This commit is contained in:
Derek Smith 2023-03-18 11:07:20 -04:00
parent dcf9e37407
commit 94ac3d6dab
Signed by: farscapian
GPG Key ID: B443E530A14E1C90

View File

@ -111,12 +111,28 @@ if [ "$VIRTUAL_MACHINE" = base ]; then
ssh_authorized_keys:
- ${SSH_AUTHORIZED_KEY}
EOF
if [ "$REGISTRY_URL" != "https://index.docker.io/v1" ]; then
cat >> "$YAML_PATH" <<EOF
write_files:
- path: /etc/docker/daemon.json
permissions: 0644
owner: root
content: |
{
"registry-mirrors": ["${REGISTRY_URL}"]
"registry-mirrors": [
"${REGISTRY_URL}"
]
}
EOF
fi
cat >> "$YAML_PATH" <<EOF
runcmd:
- sudo mkdir -m 0755 -p /etc/apt/keyrings
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
@ -124,6 +140,7 @@ if [ "$VIRTUAL_MACHINE" = base ]; then
- sudo apt-get update
- sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- sudo DEBIAN_FRONTEND=noninteractive apt-get install -y openssh-server
- sudo chown -R ubuntu:ubuntu /home/ubuntu/
EOF