Get startedGet started for free

Writing a compose.yaml file

You'd like to implement your application using Docker compose. To start with, you want to create a Docker Compose application using a single resource and continue from there.

For your application, you're currently using the container image named test_app:latest. It requires a networking redirect of port 8000 on the host to port 8000 in the container.

This exercise is part of the course

Intermediate Docker

View Course

Exercise instructions

  • Create a new resource named primary.
  • Specify the container name as webapp.
  • Use the proper image information.
  • Specify the port forwarding details in the proper subsection.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

services:
  # Specify the resource name
  ____
    
    # Define a container name
    ____: webapp
    
    # Use the proper image
    ____
    
    # Define the correct entries to forward ports
    ports:
      - "____"
Edit and Run Code