In the following snippet:
|
if let Some(cmd) = &config.cmd { |
|
let env = config.env.unwrap_or_default(); |
|
return Ok((cmd.clone(), env)); |
|
} |
|
|
|
// If no CMD instructions are found, try to locate an ENTRYPOINT command |
|
if let Some(entrypoint) = &config.entrypoint { |
|
let env = config.env.unwrap_or_default(); |
|
return Ok((entrypoint.clone(), env)); |
|
} |
The nitro-cli utility extracts the entrypoint of the resulting image being built.
It does so by:
- Checking if a
CMD command is present.
- If not (and only in that case) it uses the
ENTRYPOINT command.
This is incompatible with the Dockerfile reference (see CMD and ENTRYPOINT reference).
In particular it is stated that when an ENTRYPOINT is present, the CMD is merely set as a default set of arguments to the ENTRYPOINT.
For example:
If the user specifies arguments to docker run then they will override the default specified in CMD, but still use the default ENTRYPOINT.
I think an expected behavior would be the equivalent of running docker run which is the concatenation of ENTRYPOINT (if present) with CMD (if present). If none exists, one should probably just run the default login shell.
In the following snippet:
aws-nitro-enclaves-cli/enclave_build/src/docker.rs
Lines 273 to 282 in 9758997
The
nitro-cliutility extracts the entrypoint of the resulting image being built.It does so by:
CMDcommand is present.ENTRYPOINTcommand.This is incompatible with the Dockerfile reference (see CMD and ENTRYPOINT reference).
In particular it is stated that when an
ENTRYPOINTis present, theCMDis merely set as a default set of arguments to theENTRYPOINT.For example:
I think an expected behavior would be the equivalent of running
docker runwhich is the concatenation ofENTRYPOINT(if present) withCMD(if present). If none exists, one should probably just run the default login shell.