0% found this document useful (0 votes)
15 views2 pages

Docker Compose Lab for Multi-Container Apps

Uploaded by

Chiran Govinna
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Docker Compose Lab for Multi-Container Apps

Uploaded by

Chiran Govinna
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CO515-2024 : Advances in Computer

Networks: Selected Topics


Objective: The objective of this lab exercise is to familiarize undergraduate students
with Docker Compose, a tool used for defining and running multi-container Docker
applications.

Prerequisites:

• Basic understanding of Docker and containers.


• Docker installed on the system.

Lab Exercise: In this exercise, students will create a basic multi-container application
using Docker Compose. The application will consist of two services: a web server and
a database.

Instructions:

1. Setup:
o Make sure Docker is installed on your system.
o Create a new directory for your project.
o Inside the project directory, create two files: Dockerfile and docker-
[Link] .
2. Create Dockerfiles:
o Write Dockerfiles for both services (web server and database).
o For example, for a simple [Link] web server:

3. Write [Link]:
o Create a [Link] file to define the services.
o Here's an example for a [Link] web server and a MongoDB database:
4. Build and Run the Application:
o Run the following command in the project directory to build and run
the application:

docker-compose up
o This command will start both services defined in the docker-
[Link] file.
5. Access the Application:
o Access the web server from a web browser at
[Link] .
o You can interact with the application to see how it communicates with
the database.
6. Cleanup:
o After you're done, stop the running containers by pressing Ctrl + C .
o Optionally, you can run docker-compose down to remove the
containers.

Discussion Questions:

• What is Docker Compose, and how does it differ from Docker?


• What are the benefits of using Docker Compose for multi-container
applications?
• Explain the purpose of each section in the [Link] file.
• What are some real-world scenarios where Docker Compose can be useful?
• Submit the report in one week time.

You might also like