Ingensi / dockbeat

Dockbeat - the elastic Beat for docker daemon monitoring
Other
286 stars 70 forks source link

Set an entrypoint instead a command for the docker image #98

Closed gpolaert closed 8 years ago

gpolaert commented 8 years ago

If you want to override some args to the run command, you need to rewrite ingensi/dockerbeat ./dockerbeat -d "debug" instead of just ingensi/dockerbeat -d debug.

This PR fix it.

codecov-io commented 8 years ago

Current coverage is 70.04%

Merging #98 into develop will not affect coverage as of 86b2811

@@            develop     #98   diff @@
=======================================
  Files             7       7       
  Stmts           404     404       
  Branches         25      25       
  Methods           0       0       
=======================================
  Hit             283     283       
  Partial           4       4       
  Missed          117     117       

Review entire Coverage Diff as of 86b2811

Powered by Codecov. Updated on successful CI builds.

erwanncloarec commented 8 years ago

An entrypoint can be useful in that case, but if we don't want to run dockerbeat command at start time, it becomes complicated.

An entrypoint often comes with a script. You can see in the best practice from Docker. The script finishes with an exec "$@" .

gpolaert commented 8 years ago

Your base image is golang:1.5.1. Possibilities are very limited. Helper scripts are useful when you have to tricks something before start or run your commands. init-db for postgres, hdfs dfs format for hadoop and so on.

Here, dockerbeat is the unique reason why your building an image.

IMO, you have to change/add some args -c or -d more often than just using another command like bash.

Changing the default entrypoint is quite simple too, --entrypoint bash does the job.

marminthibaut commented 8 years ago

@gpolaert could you add a basic entrypoint.sh in the etc directory and set it as entrypoint?

As @erwanncloarec said, this script should finishes with a exec "$@" line. It will allow user to run another command than dockerbeat without using the --entrypoint argument.

Thanks!

gpolaert commented 8 years ago

@marminthibaut no ;) IMO there is no utility to have a script like it, even if it's written in best practices. Keep the current behavior, if you prefer

marminthibaut commented 8 years ago

Here, dockerbeat is the unique reason why your building an image.

Finally agreed!

Thanks!