Skip to content

Small example of building a docker swarm for testing using vagrant.

License

Notifications You must be signed in to change notification settings

anieriz/vagrant-docker-swarm-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

vagrant-docker-swarm

Small example of building a docker swarm for testing using vagrant.

Configuration

Set numworkers for more virtual machines, change vmmemory and numcpu for more resources for each virtual machine in the Vagrantfile.

numworkers = 2
vmmemory = 512
numcpu = 1

The docker swarm is built automatically by sharing the worker token via a shared file on the host machine.

A private network starting at 10.2.2.2 (manager node) is created and incremented by one for each worker.

Usage

Start the virtual machines

vagrant up

SSH into the different machines with their names:

vagrant ssh manager
vagrant ssh worker1
vagrant ssh worker2

If you ssh into the manager node you can launch docker services:

docker service create --replicas 3 --name webserver -p 80:80 nginx

On the host system open a browser and enter the IP of one of the machines of your swarm 10.2.2.2, 10.2.2.3, 10.2.2.4 and you should see the welcome message of nginx.

If you want to remove the webserver just execute:

docker service rm webserver

To destroy everything again

vagrant destroy -f

Inspiration

Inspired by: https://github.com/tdi/vagrant-docker-swarm

About

Small example of building a docker swarm for testing using vagrant.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Shell 100.0%