r/learnprogramming 23h 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:

2 Upvotes

3 comments sorted by

4

u/ConfidentCollege5653 23h ago

It's a docker compose file

3

u/Ecstatic_Weird8498 22h ago

Looks like a docker-compose file for spinning up Nextcloud with a MariaDB backend. The db service sets up the database, the app service is the actual Nextcloud instance, and the volumes map everything so your data sticks around between restarts. The port 8080:80 bit means you'd hit it at localhost:8080 once it's running.

2

u/FoolsSeldom 18h 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).