...

/

Summary: Fixing Common Issues with Docker

Summary: Fixing Common Issues with Docker

Get a recap on the overview of fixing common issues in Docker.

Docker Compose overview

We introduced what Docker Compose is. We defined Docker Compose as an orchestrator for running multiple containers using a YAML script for configuring services. We stated that Docker Compose uses a declarative concept for defining services, i.e., we define the desired state of our application, and it gives us just that. We explained that the Docker Compose YAML script consists of multiple sections like version, services, networks, and volumes. Here’s how a Docker Compose file is structured:

Press + to interact
version: '3'
services:
apache:
image: httpd:latest
ports:
- 80:80
volumes:
- ./httpd.conf:/usr/local/apache2/conf/httpd.conf
- ./html:/usr/local/apache2/htdocs
command: ["sh", "-c", "tail -f /dev/null"]
stdin_open: true
tty: true
redis:
image: redis:latest
ports:
- 6379:6379
networks:
frontend:
backend:

We used Docker CLI commands, some of which can be seen below.

Press + to interact
# This command creates and starts containers defined in the Docker Compose file
docker-compose up -d
# This command gives us a list of services running in our Docker Compose file
docker-compose ps

Accessing files in an image

We look at reasons why files should be accessed or read in an image. Some of the reasons are:

  • Security

  • Debugging

  • Verifying build process

  • Inspecting contents

  • Extracting data

We discussed what to note when accessing files in an image:

  • Image layers

  • File permissions ...