I have an upstart script (say /etc/init/dtest.conf )
start on runlevel [2345] stop on runlevel [!2345] respawn script DID=$(docker.io run -d ubuntu /bin/bash -c "echo Starting;sleep 20;echo Stopping") docker.io attach $DID end script
When launch start dtest is released, the correct cycle "Start ... Stop" forever start dtest in the dropdown logs.
However, if I stop dtest , it means that it crashes correctly, but the container will work for the remaining sleep time (as evidenced by the launch of docker.io ps every second).
Should there be an easy way to launch a docker image in a container with an upstart and manage its life cycle?
My ideal script would be something like this:
start on runlevel [2345] stop on runlevel [!2345] respawn exec docker.io run -d ubuntu /bin/bash -c "echo Starting;sleep 20;echo Stopping"
Environment:. This is on AWS using Ubuntu 14.04 on T2.micro, with apt-get install -y docker.io being the only one installed
source share