As I’m a huge fan of Vagrant, this is the Vagrantfile I’m using to create in 1 run 3 nodes docker environment:
# -*- mode: ruby -*- # vi: set ft=ruby : # Every Vagrant development environment requires a box. You can search for # boxes at https://atlas.hashicorp.com/search. BOX_IMAGE = "bento/ubuntu-20.04" NODE_COUNT = 3 Vagrant.configure("2") do |config| if Vagrant.has_plugin?("vagrant-vbguest") then config.vbguest.auto_update = false end config.vagrant.plugins = "vagrant-docker-compose" # install docker and docker-compose config.vm.provision :docker config.vm.provision :docker_compose config.vm.box_check_update = false (1..NODE_COUNT).each do |i| config.vm.define "docker_node#{i}" do |subconfig| subconfig.vm.box = BOX_IMAGE subconfig.vm.hostname = "node#{i}" subconfig.vm.network :private_network, ip: "192.168.10.#{i + 100}" subconfig.vm.provider "virtualbox" do |vb| vb.name = "docker_node#{i}" end end end end
Let’s start the creation of the VMs and measure the execution time (in Windows 10 this time 🙂 ):
PS D:\vagrant\docker> Measure-Command { vagrant up } Days : 0 Hours : 0 Minutes : 10 Seconds : 28 Milliseconds : 173 Ticks : 6281737909 TotalDays : 0.00727052998726852 TotalHours : 0.174492719694444 TotalMinutes : 10.4695631816667 TotalSeconds : 628.1737909 TotalMilliseconds : 628173.7909
Now if you want to see the status:
vagrant global-status id name provider state directory ------------------------------------------------------------------------ 00f2ce8 docker_node1 virtualbox running D:/vagrant/docker 80dda8d docker_node2 virtualbox running D:/vagrant/docker 6b7e183 docker_node3 virtualbox running D:/vagrant/docker
Let’s check the docker version:
PS D:\vagrant\docker> vagrant ssh docker_node1 Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-58-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Mon 29 Mar 2021 07:09:32 AM UTC System load: 0.08 Users logged in: 0 Usage of /: 3.2% of 61.31GB IPv4 address for docker0: 172.17.0.1 Memory usage: 22% IPv4 address for eth0: 10.0.2.15 Swap usage: 0% IPv4 address for eth1: 192.168.10.101 Processes: 101 This system is built by the Bento project by Chef Software More information can be found at https://github.com/chef/bento [email protected]:~$ docker version Client: Docker Engine - Community Version: 20.10.5 API version: 1.41 Go version: go1.13.15 Git commit: 55c4c88 Built: Tue Mar 2 20:18:20 2021 OS/Arch: linux/amd64 Context: default Experimental: true Server: Docker Engine - Community Engine: Version: 20.10.5 API version: 1.41 (minimum version 1.12) Go version: go1.13.15 Git commit: 363e9a8 Built: Tue Mar 2 20:16:15 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.4.4 GitCommit: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e runc: Version: 1.0.0-rc93 GitCommit: 12644e614e25b05da6fd08a38ffa0cfe1903fdec docker-init: Version: 0.19.0 GitCommit: de40ad0 [email protected]:~$