I wanted to bootstrap my Azure VM with Docker and Docker-compose using cloud-init. So far I tried something like below.
#cloud-config
package_update: true
package_upgrade: true
groups:
- docker: [default]
runcmd:
- [ sh, -c, "curl -sSL https://get.docker.com/ | sh" ]
- [ sh, -c, "sudo curl -L "https://github.com/docker/compose/releases/download/$(git ls-remote https://github.com/docker/compose | grep refs/tags | grep -oP "[0-9]+\.[0-9][0-9]+\.[0-9]+$" | tail -n 1)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose" ]
- [ sh, -c, "sudo chmod +x /usr/local/bin/docker-compose" ]
But it doesn't install the docker/ docker-compose and get below error
cloud-init[958]: 2019-02-28 00:51:02,447 - util.py[WARNING]: Failed loading yaml blob. Invalid format at line 11 column 32: "while scanning a plain scalar
[ 333.241244] cloud-init[958]: in "<unicode string>", line 11, column 32:
[ 333.245521] cloud-init[958]: - [ sh, -c, "sudo curl -L "https://github.com/docker/compos ...
2019/02/28 00:51:04.015216 INFO Daemon Wire protocol version:2012-11-30
[ 333.245619] cloud-init[958]: ^
[ 333.259509] cloud-init[958]: found unexpected ':'
[ 333.259584] 2019/02/28 00:51:04.019282 INFO Daemon Server preferred version:2015-04-05
cloud-init[958]: in "<unicode string>", line 11, column 37:
[ 333.474295] cloud-init[958]: - [ sh, -c, "sudo curl -L "https://github.com/docker/compose/rel ...
[ 333.514672] cloud-init[958]: ^
[ 333.554215] cloud-init[958]: Please check http://pyyaml.org/wiki/YAMLColonInFlowContext for details."
[ 333.593764] cloud-init[958]: 2019/02/28 00:51:04.361760 INFO Daemon Waiting for ssh host key be generated at /etc/ssh/ssh_host_rsa_key.pub [1800 attempts remaining, sleeping 1s]
2019-02-28 00:51:02,470 - util.py[WARNING]: Failed loading yaml blob. Invalid format at line 11 column 32: "while scanning a plain scalar
[ 333.705350] cloud-init[958]: in "<unicode string>", line 11, column 32:
[ 333.731074] cloud-init[958]: - [ sh, -c, "sudo curl -L "https://github.com/docker/compos ...
[ 333.769118] cloud-init[958]: ^
[ 333.789992] cloud-init[958]: found unexpected ':'
[ 333.808855] cloud-init[958]: in "<unicode string>", line 11, column 37:
[ 333.831502] cloud-init[958]: - [ sh, -c, "sudo curl -L "https://github.com/docker/compose/rel ...
[ 333.863028] cloud-init[958]: ^
[ 333.885648] cloud-init[958]: Please check http://pyyaml.org/wiki/YAMLColonInFlowContext for details."
[ 333.915174] cloud-init[958]: 2019-02-28 00:51:02,470 - util.py[WARNING]: Failed at merging in cloud config part from part-001
Apart from it I doubt how can I add Azure auto created default user (which was provided from UI) to docker group.