JSONArgsRecommended is broken?
Is this a docs issue?
- [x] My issue is about the documentation content or website
Type of issue
Information is incorrect
Description
What I had before, which was working perfectly fine:
ENTRYPOINT service rsyslog start && \
service dbus start && \
bash
With the recent update, now is telling me about to use JSONArgsRecommended:
ENTRYPOINT ["service rsyslog start", "service dbus start", "bash"]
Failed with:
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "service rsyslog start": executable file not found in $PATH: unknown.
Also tried with the following to run the whole thing as one liner:
ENTRYPOINT [ \
"service rsyslog start && \
service dbus start && \
bash" \
]
Failed with:
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "service rsyslog start && service dbus start && bash": executable file not found in $PATH: unknown.
Location
https://docs.docker.com/reference/build-checks/json-args-recommended/
Suggestion
So, either don't recommand JSON args or maybe also give an exapline that would work? Pretty please, thanks!
Thanks; I will add some more examples. Exec form expects executables and args to be different array elements. For example:
ENTRYPOINT ["rsyslogd", "-n"]
However, && is a shell feature, which works only when you use the CMD syntax (because then the command gets executed with /bin/sh -c)
To achieve the same thing while using a json/exec form of ENTRYPOINT, you can create an entrypoint script that does run in a shell.
COPY --chmod=755 <<EOT /entrypoint.sh
#!/bin/sh
set -ex
service rsyslog start
service dbus start
bash
ENTRYPOINT ["/entrypoint.sh"]
This gets rid of the warning... Buuuut, you're still starting your container under a shell, which adds an unnecessary shell process that acts as PID 1. This shell won't handle signals like SIGTERM properly, causing issues with process management (e.g., proper shutdown). Containers should use the main executable directly as PID 1.
Again, thanks for reporting, I will make sure to clarify the documentation.
Improved the description in upstream: moby/buildkit#5451 - will be published w/ the next buildkit release (soon)
Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.
If you have found a problem that seems similar to this, please open a new issue.
/lifecycle locked