Skip to content

build-enclave ignores Dockerfile ENTRYPOINT when CMD is present #714

Description

@MatanHamilis

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:

  1. Checking if a CMD command is present.
  2. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions