Docker Compose on Cloud Init Azure

The commands are not executed, because the syntax is not recognized.
I read in the cloud init documentation about runcmd

the list has to be proper yaml, so you have to quote any characters yaml would eat (‘:’ can be problematic)

This should do the trick:

– [ cd, /srv/compose/composeforsvaret, / ] // or - [ sh, -c , "cd /srv/compose/composeforsvaret" ]
– [ sh, -c, "docker-compose stop" ]
- [ sh, -c, "docker-compose up -d" ]
final_message: "Your Docker server is now ready."

Also keep in mind that runcmd only runs during the first boot, so depending on your purpose you should consider bootcmd!

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top