Launching architecture using Docker Compose

  • Introduction to Docker-Compose.
  • Need of Docker-Compose.
  • Forming a simple Docker-Compose File.
  • Race-condition in spinning-up docker-containers through docker-compose.
  • Launching entire architecture through Docker-compose.
  • Checking logs of containers launched through Docker-compose.
  • Rolling out changes with Docker-compose fastly.
  • It’s all of the configuration data for all of the containers that we need to run our development environments.
  • With the help of Docker-compose, we basically define the configuration of our entire running architecture.
docker container run -v /Users/B0218162/Documents/LEARNINGS/MEDIUM-BLOG/Docker/DOCKER_LEARN/DATA_DIR_FOR_CONTAINER:/var/lib/mysql -d -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=fleetman --network aditya-network --name mysqldbpanga mysql:5
docker-compose -v
  • In this case, name of our container is : “mysqldbpanga”.
  • We shall be using this image, in order to build the container : “mysql:5”.
  • This container shall be using the network with name : “aditya-network”.
  • We shall also be supplying some environment-variables to be passed to this container : “MYSQL_ROOT_PASSWORD” and “MYSQL_DATABASE”.
  • We have also defined the label for the volume as : “aditya-volume”.
  • In this case, container-name is : “webappwithmysql-fleetman-cont”.
  • We shall be using this image(which we built in previous blog), in order to build the container : “adityagoel123/fleetman-web-with-mysql”.
  • This container shall be using the network with name : “aditya-network”.
  • The container-port shall be 8080 in this case and same shall be exposed on the host machine at port no. 8084.
  • This container would also be connecting to the above container (that we created in step #3) and therefore, this container also depends upon: “mysqldbpanga”. Note that, it’s very important to mention “depends_on” clause in docker-compose file, so as to maintain the startup order.
doocker-compose up -d
doocker-compose logs -f <SERVICE_NAME>
mvn package
docker-compose up -d

--

--

--

Software Engineer for Big Data distributed systems

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What You Should Know Before Hiring A Magento Developer

Learn Git in 13 Words (Part 1 of 3)

How to host VS Code on a vps using Coder (aka:code-server)

What is PyTorch, and How Does It Work: All You Need to Know

Ten Best Countries for Hiring Dedicated Development Team — KeenEthics Blog

Going Transaction-less

(Auto) Scaling dimensions inside Azure Kubernetes Service (AKS)

Tackling the GDPR Project

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
aditya goel

aditya goel

Software Engineer for Big Data distributed systems

More from Medium

LEARN TO DEPLOY POSTGRES HA ON KUBERNETES IN 60 MINUTES

Docker for devs with hands-on| Part-4

Docker Network Drivers Overview | Networking in Docker #3

Secure application using Nginx Auth and Docker