Docker Community Forums

Share and learn in the Docker community.

Default init sequence / folder structure


(Xoeisxoe) #1

I recently stumbled over It’s not precisely the micro service philosophy at it’s purest expression, but there is one thing I pretty much like about it:

I spend (still) an (unnecessary) lot of time in mental deadlock on how to structure different init scripts and entry points in a correct way. Usually this involves

  1. Scripting the container commands, mean:CMD
  2. Dealing with environment variables & secrets
  3. Dealing with configuration
  4. Sometimes: Dealing with ownership & permissions (however I recently discovered git update-index --chmod=+x)
  5. Executing the actual service

It would be nice if there would be an “official way” of doing it in the form of a .tar which would be ADD-ed directly from a remote git repository and could be used by setting the ENTRYPOINT to /init. Be it a single binary or a set of sh files, I thing it would help consolidate thoughts on structure about this problem spend around the globe.

(Sam) #2

i don’t understand the issue?

entrypoint is called, and is passed any data coded in CMD if no other parms are passed on the docker run command.

HOW you ‘init’ your application in the container is up to you and the demands of the application.

there cannot be a generic init entrypoint… if there was, it would be simple, call $cmd… what a waste.

(Xoeisxoe) #3

HOW you ‘init’ your application in the container is up to you and the demands of the application

I think in turn there is a pattern to it, so to rephrase (hypothetically):

What genuine steps you usually undertake and concepts you apply to init your container can be of broader interests, if your patterns are useful, clearly structured and well documented.

This idea (not precisely an issue) is about convergence and brain share.
Or in more technical terms: standardizing repeatable patterns and workflows.

I’ve acquired a notion of some recurring tasks when scripting containers… Don’t you have an instance of a situation where you where also thinking: “Ok, now fix permissions”, “now application init”, “then run commands” or how should I best structure it again?

PS: I don’t claim it’s a exceptionally good idea. But I think it has it’s niche.