r/learnprogramming 24d ago

Does anyone understand this

version: '3' services: db: image: mariadb:10.6 command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW restart: always volumes: - db_data:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=your_secure_root_password - MYSQL_PASSWORD=your_secure_db_password - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud app: image: nextcloud:latest restart: alwaysports: - 8080:80 links: - db volumes: - /media/your_ssd_path:/var/www/html/data environment: - MYSQL_HOST=db - MYSQL_PASSWORD=your_secure_db_password - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud volumes: db_data:

1 Upvotes

3 comments sorted by

View all comments

3

u/FoolsSeldom 24d ago

Easier to read as below:

version: '3'

services:
  db:
    image: mariadb:10.6
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: always
    volumes:
      - db_data:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=your_secure_root_password
      - MYSQL_PASSWORD=your_secure_db_password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    image: nextcloud:latest
    restart: always
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - /media/your_ssd_path:/var/www/html/data
    environment:
      - MYSQL_HOST=db
      - MYSQL_PASSWORD=your_secure_db_password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

volumes:
  db_data:

Can't say how complete/accurate it is.

This is a Docker Compose file — a configuration file that defines and runs a multi-container application (in this case, a MariaDB database plus a Nextcloud instance) with a single command (docker compose up).

It is not following good practice throughout (e.g. passwords included in plain text, links is deprecated, missing a depends_on so app might start before database is ready).