Meaning of ampersand (&) in docker-compose.yml file

These are a YAML feature called anchors, and are not particular to Docker Compose. I would suggest you have a look at below URL for more details

https://learnxinyminutes.com/docs/yaml/

Follow the section EXTRA YAML FEATURES

YAML also has a handy feature called ‘anchors’, which let you easily duplicate
content across your document. Both of these keys will have the same value:

anchored_content: &anchor_name This string will appear as the value of two keys.
other_anchor: *anchor_name

Anchors can be used to duplicate/inherit properties

base: &base
    name: Everyone has same name

foo: &foo
    <<: *base
    age: 10

bar: &bar
    <<: *base
    age: 20

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)