Skip to content

default entrypoint script for dockerfiles to ensure the user/group when run docker commands

Notifications You must be signed in to change notification settings

hpbuniat/docker-entrypoint

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

docker-entrypoint

Default entrypoint script for dockerfiles to ensure the user/group when running docker containers as binary replacement. An example is to run composer in a docker container.

Why I am doing this?

Assume you have composer installed on you pc. You would type composer install to install dependencies. In docker you would run this like docker run -it --rm ....

In case of docker, root is running the command. That's not what I want. I want to run the command as the user currently logged in. Otherwise the vendor directory will be created with root as owner.

So I wrap the docker run command in a shell script named like the binary I want to run. This is composer in our example.

I places these shell scripts in the home/bin directory and add this to my PATH if it's not already in. So I can call it from everywhere.

For each "binary" I create this way, I have to create a docker file that inherits from the official image and adds and runs the entrypoint script.

Each wrapper shell script has to

  • pass the uid/gid
  • pass USER and HOME env's for the current user
  • pass the current working dir and
  • mount the user's home

Content of this repository

This repo only contains the entrypoint script that is used in all my "binaries". So I don't have to copy it over and over.

About

default entrypoint script for dockerfiles to ensure the user/group when run docker commands

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%