Professional Documents
Culture Documents
Vagrant and Oracle Linux Setup For Dockers On Your Own Desktop
Vagrant and Oracle Linux Setup For Dockers On Your Own Desktop
Vagrant and Oracle Linux Setup For Dockers On Your Own Desktop
REF: link.
Basically we’ve just added the vagrant user, setup their environment for ssh and provided them
with well known keys i.e. insecure keys. It is actually straightforward to add your own keys but
for now we’ll leave that as a future exercise more information can be found here. In fact both the
user and ssh settings can be overridden in the Vagrantfile which is well documented.
Again we are trading away Security for simplicity as this will give you passwordless sudo ability
however if this is a concern you can modify to taste, for example omit the above step and use the
root login and password.
At this point if you did want additional packages or configuration you can add them now.
Remember the purpose of this exercise is simply to create a basic box which you can modify and
build on in the future. So smaller is better. It’s simple to then take this box and add some
packages in the future and derive new boxes from that image. For example you could create both
a node.js box and a http box from the original base image.
Now is a great time to remove extra packages, or stop services from starting up. Just don’t stop
sshd or you won’t be able to login! Final preparation, as root. First we run yum again in case
there are any last updates, then it is time to clean up and overwrite the free space with 0s which
will help in the shrink phase.
# yum update
# yum clean all
# dd if=/dev/zero of=/foo bs=100k
# rm /foo
# rm -rf /tmp/*
# shutdown -h
Now you are finished with preparing VM
The first command, vagrant package, actually converts the VirtualBox VM and outputs it in the
current directory as a package.box file. Then this is added in the 2nd command to your collection
of vagrant boxes as ol7-base. So now we have our newly created Vagrant box let’s test it actually
works. In an appropriate sub directory, remember the Vagrantfile will be placed there so you'll
want at least 1 directory for each box you work with.
proxy=http://www-proxy.us.oracle.com:80
Init 0 (shut down the vm and again make it up with vagrant up from the directory)
Screenshot of Virtual box showing the test ol image is running after issuing vagrant up command.
After VM is up you need to pull images, but first set http proxy file in
/etc/systemd/system/docker.service.d/
# systemctl daemon-reload
# systemctl stop docker
# systemctl start docker
# systemctl start docker
# docker pull ubuntu:latest (will pull from docker registry)
# docker pull 10.180.86.76:5000/obpui:2.6 (will pull from infra registry)
Image pull in process
If you get error like : image not found (Disk space issue)
Save image by vagrant package in same directory to save the state of machine.
In Virtual box, edit machine and add storage. And disk and memory (needed for OBP images)
After saving in Virtual BOX Manager.
Startup the machine from same directory by vagrant up
Again pull image from local repository and you are set.
Now you are set to do Dockers on your local workstations.
Ref links:
What is vagrant ?
https://www.vagrantup.com/intro/index.html
https://www.vagrantup.com/docs/vagrantfile/
https://blogs.oracle.com/devops/