Sobes.tech
Junior — Middle

Have you used Docker Compose in your projects for managing multi-container applications?

sobes.tech AI

Answer from AI

Yes, I have used Docker Compose for managing multi-container applications. It is a convenient tool for describing and running multiple related containers using a single YAML file. For example, in a project with a Python web application and a PostgreSQL database, I described the services in docker-compose.yml, set up networks and volumes for data storage, which allowed for quick environment setup and scaling.

Example docker-compose.yml:

version: '3'
services:
  web:
    build: .
    ports:
      - "8000:8000"
    depends_on:
      - db
  db:
    image: postgres:13
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: password
    volumes:
      - pgdata:/var/lib/postgresql/data
volumes:
  pgdata:

This approach simplifies local development and testing, as well as deployment.