4.1 setting up experimental environment of docker network

Time:2021-11-13

Build two virtual machines, which can ping each other or the host. Vagrantfile is configured as follows:

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.require_version ">= 1.6.0"
boxes = [
    {
        :name => "docker-node1",
        :eth1 => "192.168.205.10",
        :mem => "1024",
        :cpu => "1"
    },
    {
        :name => "docker-node2",
        :eth1 => "192.168.205.11",
        :mem => "1024",
        :cpu => "1"
    }
]
Vagrant.configure(2) do |config|
  config.vm.box = "centos/7"
  boxes.each do |opts|
      config.vm.define opts[:name] do |config|
      config.vm.hostname = opts[:name]
      config.vm.provider "virtualbox" do |v|
        v.customize ["modifyvm", :id, "--memory", opts[:mem]]
        v.customize ["modifyvm", :id, "--cpus", opts[:cpu]]
      end
      config.vm.network :private_network, ip: opts[:eth1]
    end
  end
  config.vm.synced_folder "./labs", "/home/vagrant/labs", :nfs => true
  config.vm.provision "shell", privileged: true, path: "./setup.sh"
end

The contents of setup.sh are as follows

#!/usr/bin/env bash
#/bin/sh
# install some tools
sudo yum install -y git vim gcc glibc-static telnet bridge-utils
# install docker
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh
# start docker service
sudo groupadd docker
sudo usermod -aG docker vagrant
sudo systemctl start docker
rm -rf get-docker.sh

Recommended Today

Survival analysis (I) — basis of survival analysis

Translated from:http://www.sthda.com/english/wiki/survival-analysis-basics Fundamentals of survival analysis survival analysis It corresponds to a set of statistical methods used to investigate the time spent on the occurrence of events of interest. survival analysis It can be used in many fields, such as: For patient survival time analysiscancer research , Of “event history analysis”Sociology, stayIn EngineeringUsed for “time […]