The commands are not executed, because the syntax is not recognized.
I read in the cloud init documentation about
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:
runcmd: – [ 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
CLICK HERE to find out more related problems solutions.