Skip to content
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

Container best practice is to use ENTRYPOINT rather than CMD #239

Closed
bfjelds opened this issue Feb 8, 2021 · 2 comments · Fixed by #631
Closed

Container best practice is to use ENTRYPOINT rather than CMD #239

bfjelds opened this issue Feb 8, 2021 · 2 comments · Fixed by #631
Labels
enhancement New feature or request good first issue Good for newcomers keep-alive

Comments

@bfjelds
Copy link
Collaborator

bfjelds commented Feb 8, 2021

Our containers use CMD rather than ENTRYPOINT, but it seems that best practice is to use ENTRYPOINT:

https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint

We should change our dockerfiles according to best practices.

@bfjelds bfjelds added enhancement New feature or request good first issue Good for newcomers labels Feb 8, 2021
@DazWilkin
Copy link
Contributor

Caveat: ./github/action/build-component-per-arch/main.js runs (bash) find in containers, assuming (which it shouldn't), that containers' (plural) entrypoint is a shell and that it's able to override some default command:

https://github.com/deislabs/akri/blob/fd2ed66c30c9fe4a7820a9b2feecfd3420da717e/.github/actions/build-component-per-arch/main.js#L96

A better practice (per the above) is for the container's primary function e.g. agent, controller etc. to be its entrypoint. Then, running containers is like running any other binary.

NOTE It's also preferable to not include superfluous functionality (e.g. bash) in a container whose function doesn't require bash; security, patching reasons etc.

Alternatives in this case:

  1. Run the container and docker cp ${ID}:/path/to/known/location/container-images-legal-notice.md /somewhere/on/host
  2. Retain bash or some other shell but make this a requirement for Akri developers so that you can --entrypoint=/bin/bash
  3. Require container developers to host a small httpd that responds on any path by returning the legal notice

@kate-goldenring
Copy link
Contributor

The Dockerfiles that should be changed live in our build directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers keep-alive
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants