Erwan Daniel
Erwan Daniel

Reputation: 1537

What does {} means in services section of docker-compose.yml

I want to backup my wordpress container with a simple tar command but I struggle to understand where the db folder is located.

I have the following docker-compose.yml :

version: '2.0'

services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: ***
       MYSQL_DATABASE: ***
       MYSQL_USER: ***
       MYSQL_PASSWORD: ***

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "8000:80"
       - "8001:443"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: ***
       WORDPRESS_DB_PASSWORD: ***
       WORDPRESS_DB_NAME: ***
volumes:
    db_data: {}

The db_data volume is declared with this {}, on the dokcer-compose documentation I don't find any information : https://docs.docker.com/compose/compose-file/compose-file-v2/#volumes

I suppose it's not binded to the host filesystem

Upvotes: 0

Views: 372

Answers (1)

Matthew
Matthew

Reputation: 11347

In yaml a map can be represented with a JSON-like form: {fee: fie, foe: foo}. So {} is simply an empty map - i.e. there are no volumes mounted.

See the spec here

Upvotes: 1

Related Questions