Vad1mo
Vad1mo

Reputation: 5543

Vagrant start docker container after halt

I am using Vagrant boot2docker to provision docker containers. This containers are created and started during the provision process.

After halting or restarting the VM and then calling vagrant up the containers are not restarted again.

Also vagrant provision does not work a second time because the containers all have a fixed name to the provision process can not run again.

Is there a way in Vagrant where I can restart containers on vagrant up

Upvotes: 0

Views: 798

Answers (1)

m1keil
m1keil

Reputation: 4575

These are not a Vagrant problem per se.

1) Docker by default won't start your containers on boot. You can achieve this by using Docker's restart policies.

2) If you use simple provision methods such as bash script, you should know that these are not idempotent - meaning they will run again, even if the desired state is already achieved (in your case, the state is "running containers"). So you'll need to use CM tools such as Puppet/Chef/Ansible/etc that are able to check your container state before trying to launch them.

Upvotes: 1

Related Questions