TroyWorks
TroyWorks

Reputation: 411

start multiple docker containers with a single command line shell script (without docker-compose)

I've got 3 containers that will run on a single server, which we'll call: A,B,C

Each server has a script on the host that has the commands to start docker:

A_start.sh
B_start.sh
C_start.sh

I'm trying to create a swarm script to start them all, but not sure how.

ABC_start.sh

UPDATE: this seems to work, with the first being output to the terminal, cntrl+C exits out of them all.d

./A_start.sh & ./B_start.sh & ./C_start.sh

Upvotes: 2

Views: 3482

Answers (2)

Tuhin Paul
Tuhin Paul

Reputation: 558

In bash,

you can do this:

nohup A_start.sh &
nohup B_start.sh &
nohup C_start.sh &

Upvotes: 0

dnozay
dnozay

Reputation: 24314

  1. swarm will not help you start them at all..., it is used to distribute the work amongst docker machines that are part of the cluster.
  2. there is no good reason not to use docker-compose for that use case, its main purpose is to link containers properly, and bring them up, so your collection of scripts could end up being a single docker-compose up command.

Upvotes: 3

Related Questions