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

PRE_COMMANDS: Invalid interpolation format for "environment" option in service #31

Closed
Altiano opened this issue Apr 15, 2020 · 4 comments
Labels

Comments

@Altiano
Copy link

Altiano commented Apr 15, 2020

Why this value won't work?

PRE_COMMANDS: |-
            docker stop reverse_proxy
            docker stop $(docker ps | grep blogcomments | awk '{print $1}') 
            docker stop $(docker ps | grep mailcowdockerized | awk '{print $1}') 
@djmaze
Copy link
Owner

djmaze commented Apr 16, 2020

So what exactly is the error message? Is it an error given by docker-compose during parsing?

@djmaze djmaze added the bug label Apr 16, 2020
@Altiano
Copy link
Author

Altiano commented Apr 17, 2020

The error message: PRE_COMMANDS: Invalid interpolation format for "environment" option in service

@djmaze
Copy link
Owner

djmaze commented Apr 19, 2020

Ah, right, I see ;)

Well, using advanced shell syntax in the PRE_COMMANDS or POST_COMMANDS variables probably won't work because it is just evaled inside the main script. I suggest putting those lines into a separate script file, mount that into the container and then just call the script in the PRE_COMMANDS.

@Altiano Altiano closed this as completed Apr 22, 2020
@alexmisk
Copy link

Hеу! Sorry for necroposting, but I've just faced almost the same issue.

Try to double the $ sign in your PRE_COMMANDS like this:

PRE_COMMANDS: |-
            docker stop reverse_proxy
            docker stop $$(docker ps | grep blogcomments | awk '{print $$1}') 
            docker stop $$(docker ps | grep mailcowdockerized | awk '{print $$1}') 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants