DEV Community

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

Posted on

1

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

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay