简体   繁体   中英

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

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

See the spec here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM