YAML, Docker Compose, Spaces & Quotes

After some googling I’ve found a blog post
that touches this problem as I understood it.

I’ll cite the most important part here:

plain scalars:
- a string
- a string with a \ backslash that doesn't need to be escaped
- can also use " quotes ' and $ a % lot /&?+ of other {} [] stuff

single quoted:
- '& starts with a special character, needs quotes'
- 'this \ backslash also does not need to be escaped'
- 'just like the " double quote'
- 'to express one single quote, use '' two of them'

double quoted:
- "here we can use predefined escape sequences like \t \n \b"
- "or generic escape sequences \x0b \u0041 \U00000041"
- "the double quote \" needs to be escaped"
- "just like the \\ backslash"
- "the single quote ' and other characters must not be escaped"

literal block scalar: |
  a multiline text
  line 2
  line 3

folded block scalar: >
  a long line split into
  several short
  lines for readability

Also I have not seen such docker-compose syntax to set env variables. Documentation suggests using simple values like

environment:
  - ENV1=abc
  - "ENV2=abc"

Where quotes " or ' are optional in this particular example according to what I’ve said earlier.

To see how to include spaces in env variables you can check out this so answer

Leave a Comment

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