Docker Community Forums

Share and learn in the Docker community.

Is there any alternative for docker-machine to initialize a swarm master?

(Saravana9210) #1

I’m trying to deploy services in swarm cluster using docker 1.12.1-rc1 and docker-compose 1.8.0

I’ve 4 VMs (NOT created through docker-machine)

VM1 - consul server is running in a docker container (for service discovery)
VM2 - where I want to initialize a swarm master with ‘docker swarm init’ command
VM3 - slave node1
VM4 - slave node2

I’m following to setup my cluster. I’m just looking for an alternative for following command:

docker-machine create -d virtualbox --swarm --swarm-master
–swarm-discovery=“consul://$(docker-machine ip nb-consul):8500”
–engine-opt=“cluster-store=consul://$(docker-machine ip nb-consul):8500”
–engine-opt=“cluster-advertise=eth1:2376” nb1

Basically, this command create a vm with docker swarm master with consul details defined. Since I’m not using docker-machine, is there any other options like ‘docker swarm init [options]’ with which I can define my consul server details?

Basically, I want my swarm master node to know where consul is running.

Thanks in advance :slight_smile:

(Yiwang8621) #2

I followed the steps in to initialize the swarm, it does not use docker machine and virtualbox.

(Saravana9210) #3

Hi Yiwang,

Thank you for the information !

This tutorial is just a guide to create a basic cluster setup. But, my setup needs swarm to be integrated with consul (for service discovery) also. In that case, I’ve to create my swarm cluster with some additional options.

This means when I’m creating the swarm master, ‘docker swarm init --advertise-addr <master_IP>’ command is not sufficient. I need to mention few other options like --cluster-store, --cluster-advertise, etc.

These options can be given in config file (/etc/docker/daemon.json) while starting the daemon. But, I’m using docker 1.12.1 tarball and extracted it. I somehow not able to find which config file this docker binary uses to start.

Please guide me to appropriate link if possible.

Thanks in advance :slight_smile:

(Saravana9210) #4

I got it :slight_smile:

Created /etc/docker/daemon.json file manually and started daemon as ‘docker daemon --config-file /etc/docker/daemon.json’