-
Notifications
You must be signed in to change notification settings - Fork 20
Closed
Description
Consider this sample Dockerfile (abridged version of a real-world scenario):
ENTRYPOINT sleep infinity
CMD sleep infinity
Let's run dockerfmt (v0.3.7) in it:
% dockerfmt Dockerfile
ENTRYPOINT ["sleep", "infinity"]
CMD ["sleep", "infinity"]
At first glance, everything looks OK. The problem is that this transformation is not a no-op.
Looking at the docs:
- https://docs.docker.com/reference/dockerfile/#cmd
- https://docs.docker.com/reference/dockerfile/#shell-and-exec-form
If CMD is used to provide default arguments for the ENTRYPOINT instruction, both the CMD and ENTRYPOINT instructions should be specified in the exec form.
The difference is:
- the original code yields
sleep infinity(correct!) - the transformed code yields
sleep infinity sleep infinity, which is an error (sleep:no such argument sleep)
One could argue that the original code is odd – the following would be conceptually simpler, and more idiomatic:
ENTRYPOINT ["sleep"]
CMD ["infinity"]
Or even:
ENTRYPOINT ["sleep", "infinity"]
Nonetheless, IMHO dockerfmt should not change the behavior in this case.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels