I would like to start my application automatically from cloud config. I have it already like this:
- path: /opt/rancher/bin/start.sh permissions: "0755" content: | #!/bin/bash if [ ! -f /opt/bin/docker-compose ]; then sudo mkdir /opt/bin sudo wget -O /opt/bin/docker-compose https://github.com/docker/compose/releases/download/1.5.1/docker-compose-uname -s
sudo chmod +x /opt/bin/docker-compose fi sleep 10 export V4_PRIVATE_IP=$V4_PRIVATE_IP export V4_PUBLIC_IP=$V4_PUBLIC_IP wget -q -O docker-compose.yml http://boot.xxx.yyy/docker-compose.www.yml export COMPOSE_PROJECT_NAME=www /opt/bin/docker-compose --x-networking --x-network-driver bridge up -d >> /var/log/compose.log 2>&1
The problem is that docker is not ready until the file start.sh is fully executed! Because of that, docker-compose fails with message:
Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running? If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
Any idea? Is there an option to auto-run some scripts at the time user docker is ready? For obvious reason I don’t want to run the app as system service.