I am running an EC2 instance with a startup script that is called on reboot. This startup script checks that the docker daemon is running before then starting the container, but fails with the error:
Post http:///var/run/docker.sock/v1.13/containers/create: dial unix /var/run/docker.sock: no such file or directory
Startup Script
# Make sure the docker daemon has started
sudo /usr/sbin/service docker start
# start the container
sudo /usr/bin/docker run -d 91b5261e2dc0
Please note that his is on an ec2 instance where "sudo" does not require password entry.
Crontab entry:
@reboot /bin/bash /home/ubuntu/start-container.sh 2> /home/ubuntu/cron_errors.log
Errors:
start: Job is already running: docker
2014/08/01 09:45:48 Post http:///var/run/docker.sock/v1.13/containers/create: dial unix /var/run/docker.sock: no such file or directory
Whenever I manually run the startup script, it works perfectly which makes it seem like an Environment variable/PATH issue to me. Googling around found information about not setting the DOCKER_HOST, but the startup script works fine even when DOCKER_HOST is still not set.
What do I need to change or define to ensure the container starts correctly on startup?
Versioning Info
OS: Ubuntu 14.04 Hardware Virtualized.
Docker version:
Client version: 1.1.2
Client API version: 1.13
Go version (client): go1.2.1
Git commit (client): d84a070
Server version: 1.1.2
Server API version: 1.13
Go version (server): go1.2.1
Git commit (server): d84a070
uname -a output
Linux ip-10-76-167-92 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux