-
-
Notifications
You must be signed in to change notification settings - Fork 200
[FEAT] Add Exec form to "command" and "entrypoint" in cosmos compose. #495
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
base: unstable
Are you sure you want to change the base?
Conversation
|
This probably also fixes this one: #387 |
|
I dont think "Existing templates using shell form (string) are converted to an array containing a single string element." is the correct behaviour tho, because Docker is going to see it has which means bash is going to receive a single command with a space in it - needs some testing before it can be merged |
|
Yeah I agree. There are probably some setups running atm which would break with this code. You can even see this in my commit, I had to change the mongo cmd parameters, otherwise it was failing to start. Though tbf those templates usually were inconsistent with other, plain docker setups and ressources/documentations anyway and this commit just reverts that discrepancy. To be 100% consistent with docker, cosmos should execute single strings as one line, while appending /bin/sh -c as a prefix. From a functionality standpoint, this is not strictly necessary though as it can be appended manually. |
|
I'm gonna test some apps from the official market with this PR with the following procedure:
So far tested Apps: I think i stop here with alphabetical test and commence only the ones with entrypoints / commands in their template: |
|
OK so from my testing you are correct, @azukaar The apps with commands containing spaces break (Nextcloud, Photoprism, Trip). The rest works as expected. Take the app Trip for example: This PR fixes that and mandates cosmos to use the same setup as the official documentation from Trip: So as soon as this PR gets merged, we need to also merge azukaar/cosmos-servapps-official#200 into the servapps (which I just created). This way, new setups will work regardless. |
|
Hmm yes that's what I thought. So it's good to migrate the market but it's not that simple, if we do that we will break all the backups of cosmos-compose that currently have this as a string. It will also break docker-compose files that have the string version which, while inferior, is more common. The missing pieces are
Both of those things happen in docker-compose.jsx but it is a very (overly) complicated part of the code so I would understand if that's not something you want to give a go at |
|
I see, let me have a look at that file (docker-compose.jsx) when I got some spare time. |










This small change in the code allows for usage of the exec form in
CMDandENTRYPOINTcommands.The exec form is functionally superior to the shell form allowing for more complex executions including f.e. the
&&and||operators and more.Meanwhile it can still behave as the shell form does, when appending
[ "/bin/sh", "-c" ]to the beginning of the exec form array.Docker Documentation
Specific table comparing the different usages of exec and shell form in docker:

I have tested it against several images of my own market and on existing machines and it seems to work flawlessly. Existing templates using shell form (string) are converted to an array containing a single string element.