• LOGIN
  • No products in the cart.

DevOps on AWS – Setting up Vagrant file for Docker Container

Step 1:
            > mkdir docker
            > cd docker
            > vagrant box add bento/centos-7.2
            > vagrant init
Step 2:     Copy and paste the following content in ‘vagrantfile’
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = “2”
ENV[‘VAGRANT_DEFAULT_PROVIDER’] = ‘virtualbox’
HOST_IP = “192.168.10.40”
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define “dockerServer1” do |dockerServer1|
dockerServer1.vm.hostname = “dockerServer1.rnstech.com”
dockerServer1.vm.box = “bento/centos-7.2
dockerServer1.vm.box_url = “bento/centos-7.2
dockerServer1.vm.network :forwarded_port, guest: 8080, host: 8080dockerServer1.vm.provider :virtualbox do  |vb|
vb.customize [ ‘modifyvm’, :id,  ‘–memory’, ‘2048’ ]
vb.customize [ ‘modifyvm’, :id,  ‘–cpus’,  ‘4’ ]

end
dockerServer1.vm.network :private_network,
      ip: HOST_IP,
      netmask: ‘255.255.255.0’
    dockerServer1.vm.provision “shell”, inline: <<-SHELL
    yum install -y update
yum install -y docker
systemctl start docker
docker info
systemctl enable docker
SHELL
end
end
Step 3:
            > vagrant up dockerServer1 –provision
            > vagrant ssh dockerServer1
            > sudo docker info
February 22, 2021

0 responses on "DevOps on AWS - Setting up Vagrant file for Docker Container"

    All rights reserved.
    error: Alert: Content is protected !!
    X