Operating system: Windows10
Using:
Hi, do you know how to start a container automatically at boot2docker boot?
I have created a new machine with docker-machine
. Then I have run a new container with docker run
. It's all up and and running, but when I shutdown my Windows and try to start my docker machine the container inside doesn't start. I have tried to add docker start id
command to the file /mnt/sda1/var/lib/boot2docker/profile
but it doesn't work.
I have tried also to connect to the virtual machine with ssh ( docker-machine ssh name
) and run the command docker start id
without success. Finally I have to stop and remove the container and make a docker run
again.
I suspect your container don't start because when the machine (the boot2docker VM) restarts, it still has it in an ' Exited
' state.
Confirm with a docker-machine ssh default "docker ps -a"
. (after a docker-machine start default
)
If so, add in your /mnt/sda1/var/lib/boot2docker/profile
a call to a script which will:
test if the container is exited :
docker inspect -f {{.State.Running}} $CONTAINER_ID
if the previous command
docker run
docker rm
+ docker run
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.