So, I’v tried to reproduce and here’s what I’ve got. My cloud-config is:
#cloud-config
write_files:
- path: /opt/rancher/bin/start.sh
permissions: "0755"
owner: root
content: |
#!/bin/bash
echo "I'm doing things on start" > /opt/start-sh-did-this
After I’ve logged in I can see /opt/start-sh-did-this
file is there with the expected content.
@tjmcs Docker cannot be used in these startup scripts as docker service starts after console in v0.4.0+. The best way to run docker containers on start is run them as services (I admit, I should spend more time on the docs), e.g. like with this cloud-config (adapted from @Jacob_Gadikian’s docker-run command above, this one runs Rancher Agent v0.8.2 as a privileged container bind-mounting /var/run/docker.sock):
#cloud-config
rancher:
services:
rancher-agent:
image: rancher/agent:v0.8.2
command: http://192.168.100.104:8080/v1/scripts/skipped-the-base64-stuff
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock