Search⌘ K
AI Features

Challenge: Fixing Common Issues with Docker

Explore how to identify and correct Docker Compose file errors, troubleshoot container failure problems with microservices, and resolve package and library issues when building Docker images. This lesson helps build practical skills to maintain reliable Docker container setups.

Problem 1: Fixing formatting errors and package issues

We’ve been given a docker-compose.yml file, which contains several formatting errors and a logstash.conf file to process, forward, and log. Our task is to identify and correct the errors in the docker-compose.yml file to ensure the file is formatted correctly and valid.

Here are the files:

  • The docker-compose.yml file:

YAML
version: '3'
services:
db
image: mysql:5.7
environment:
-MYSQL_ROOT_PASSWORD=admin
- MYSQL_DATABASE=mydb
- MYSQL_USER=user
- MYSQL_PASSWORD=pass
redis:
image:redis:latest
volumes:
- ./data:/data
web:
image: nginx:latest
ports:
-80:80
logging:
image: logstash:latest
volumes:
- './logstash.conf:/etc/logstash.conf'
- '/var/log:/logs'
    ...