Tomas Jansson
Tomas Jansson

Reputation: 23472

How do I configure boot2docker to start my containers on boot?

I'm fairly new to boot2docker and have some problem installing a process manager in it.

The setup I'm going for is to use vagrant to create my local boot2docker development machine and configure the containers inside that VM. The Vagrant box I'm using is this one: yungsang/boot2docker.

I have setup the boot2docker VM to create one container with this:

config.vm.provision :docker do |d|
     d.pull_images "wkruse/eventstore"
     d.run "eventstore",
         image: "wkruse/eventstore",
         args: "-p 1113:1113 -p 2113:2113 -v /data:/data",
         cmd: "--ext-ip=0.0.0.0 --http-prefixes=\"http://*:2113/\" --run-projections=all"
end

This works just fine except that the container is not started on boot. Is there a way to configure docker so it starts all the container on start, or is there a simple way to install a process manager like systemd in boot2docker that handles the start of the containers?

UPDATE

I've changed approach and use a simple script instead, but it won't work:

docker run -d -p 2113:2113 -p 1113:1113 -v /data/eventstore:/data --restart=always --name eventstore wkruse/eventstore --ext-ip=0.0.0.0 --http-prefixes="http://*:2113/" --run-projections=all

I have another container where I basically do exactly the same thing, and it works like a charm. I've also tried --restart=on-failures:10 but that doesn't work either.

UPDATE 2

If I remove -v /data/eventstore:/data it all works as I expect. Somewhat weird I think.

Upvotes: 0

Views: 620

Answers (1)

Peter Lyons
Peter Lyons

Reputation: 146154

Add --restart always to your args: line.

Upvotes: 1

Related Questions