Using a Dockerfile and Docker-Compose to Build and Run Containers

Lab Steps

lock
Logging in to the Amazon Web Services Console
lock
Connecting to the CloudAcademy Web based Containers IDE Port 8080
lock
Complete a Dockerfile and Build an Image
lock
Launch a New Docker Container and Test
lock
Build and Test a Multi Container Setup Using Docker Compose

Ready for the real environment experience?

DifficultyBeginner
Time Limit1h 30m
Students112
Ratings
4.5/5
star star star star star-half

Description

If you're building and deploying cloud native applications and microservices, then understanding container development and orchestration is a must have skill. In this Lab you'll learn how to use both Docker and Docker Compose to build and run containers.

In this Lab scenario you'll work with 2 containers. A NGINX web server container which will be configured to proxy incoming HTTP requests downstream to second container running a customised Python FLASK based web application. The NGINX web server container will use the publicly available nginx:1.13.7 docker image. The FLASK based web application container will be based on a custom docker image that you will need to first create. 

This Lab will teach you how to use and define a Dockerfile to build a FLASK based web application, and then use it with the docker build command to build a Docker Image. You'll then learn how to use Docker Compose, a tool for defining and running multi-container Docker applications, to configure and launch the dual container (Nginx -> Flask) environment.

 

Lab Objectives

Upon completion of this Lab, you will be able to:

  • Edit and update a Dockerfile to create a Flask based web application
  • Use the docker build command to build a new Docker Image and tag it with cloudacademydevops/flaskapp:latest
  • Edit and update a Docker Compose file to create a dual container (Nginx -> Flask) setup
  • Use the docker-compose command to launch a dual container (Nginx -> Flask) setup
  • Test and validate the container setup using the curl command

You should:

  • Be comfortable with basic Linux command line administration
  • Be comfortable with basic container concepts

Lab Environment

This Lab will start with the following AWS resources provisioned automatically for you:

  • A single EC2 instance, named ide.containers.cloudacademy.platform.instance, which will have a public IP address attached. This will be the instance that you will connect to using your local workstation browser.

To achieve the Lab end state, you will be walked through the process of:

  • Using your local workstation browser to remotely connect to ide.containers.cloudacademy.platform.instance
  • Using the web based IDE and integrated terminal, you'll complete the remainder of the stated Lab Objectives (above)

About the Author

Students22490
Labs32
Courses81
Learning paths19

Jeremy is the DevOps Content Lead at Cloud Academy where he specializes in developing technical training documentation for DevOps.

He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 20+ years. In recent times, Jeremy has been focused on DevOps, Cloud, Security, and Machine Learning.

Jeremy holds professional certifications for both the AWS and GCP cloud platforms.
 

Covered Topics