Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Nov 14, 2022

Conversation

Galaxy102
Copy link
Contributor

@Galaxy102 Galaxy102 commented Oct 14, 2022

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.

Before:
```
...
services:
  <service>:
    ....
    logging:
      options:
        tag: {{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}
        max-file: 3
    ...
```
and docker-compose up fails
after:
```
...
services:
  <service>:
    ....
    logging:
      options:
        tag: "{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}"
        max-file: "3"
    ...
```
and docker-compose up works
@Red5d Red5d merged commit d07ce54 into Red5d:master Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants