DEV Community

Cover image for EXPLORING DOCKER CONTAINER USING VAGRANT
collins-henry
collins-henry

Posted on

EXPLORING DOCKER CONTAINER USING VAGRANT

INTRODUCTION

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. The service has both free and premium tiers. The software that hosts the containers is called Docker Engine. docker allows you to test, build and deploy applications quickly.

Docker packages software into standardized units called containers that have everything the software needs to run including libraries, system tools, code, and runtime. A Docker container image is a lightweight, standalone, executable package of software.

CONTEXT

so for this mini project, we are going to deploy mysql, memcached , rabbitmq ,tomcat and nginx by creating docker images and also docker containers.

STEP
we are going to use vagrant for this project. so we start first by creating a vagrantfile. the vagrantfile will have extra provisioning for the download and installation of docker and compose.

Image description
here is a description of how your vagrantfile will look and the provisioning with a shell script.

here is a clearer view of the provisioning in the vagrantfile

Image description

our machine is now ready and we spin the machine up using vagrant up and ssh into our server using vagrant ssh.
since we are now logged into our server, we have to switch to the root user using the command sudo i before we start to execute our task.

so we create a directory called compose using the command
Image description.

next, we are going to download docker-compose.yml for the project
and using "wget (https://raw.githubusercontent.com/devopshydclub/vprofile-project/docker/compose/docker-compose.yml)"
Image description
then we check the content using the command "vim docker-compose.yml"

now,we bring up our containers using the command "docker compose up -d". this command will bring up the containers
Image description. this will take some time for the images to be downloaded, run the command "docker compose ps" to list images created.
next, we get our machine ip address using the command "ip addr show"
and paste it in our browser and we will have our page running

Image description

credit: devops beginners to advance by imran Teli

Top comments (0)