Red5d / docker-autocompose

Generate a docker-compose yaml definition from a running container
1.76k stars 197 forks source link

Quote all string values to reduce probability of compose syntax errors #51

Closed Galaxy102 closed 1 year ago

Galaxy102 commented 1 year ago

Hello there, thank you for your work with docker-autocompose!

I encountered some problems when recreating containers when using custom log configs.

In our case we set the log-options as follows:

  log_driver: json-file
  log_options:
    max-size: 10m
    max-file: "3"
    tag: "{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}"

The current master of the script would remove the quotes around tag and max-file, which would make docker-compose interpret these options as malformed dict and integer, both syntax violations.

The proposed solution would quote all values that are strings.

I'm glad to improve my contribution if you have any comments.