Docker image from scratch with some basic definitions:
- a non root user to run your services
- a non root user to build your services
- some variables to be used
- a nice command line prompt
Image size: ca. 2.06kB (may change)
lang
to set language, defaults toen_US.UTF-8
The environment variables are intended to be used in derieved images. They are not intended to be changed. Just use them instread of hard coding in your images.
Use these variables for user name, group and home:
RUN_USER
: set tosomebody
RUN_GROUP
: set tosomebody
RUN_HOME
: set to/home/somebody
If you need to share data on volumes between containers, and if you therefore must have a predefined group id, then use the following:
SHARED_GROUP_NAME
: set toshared-access
SHARED_GROUP_ID
: set to500
Use these variables in RUN
commands in your docker file. E.g. install package gcc
(the GNU Compiler Collection) using: RUN $PKG_INSTALL gcc
, or give the run user access to path /target
: RUN $ALLOW_USER /target
PKG_INSTALL
: set toapk add --no-cache --clean-protected -u
PKG_REMOVE
: set toapk del --no-cache --purge
PKG_SEARCH
: set toapk search --no-cache
PKG_CLEANUP1
: set toapk del --no-cache busybox alpine-baselayout
PKG_CLEANUP2
: set toapk del --no-cache --purge apk-tools zlib alpine-keys
ALLOW_USER
: give access to a path to$RUN_USER
, set tochown -R ${RUN_USER}:${RUN_GROUP}
ALLOW_BUILD
: give access to a path to$BUILD_USER
, set tochown -R ${BUILD_USER}:${BUILD_GROUP}
See mwaeckerlin/nodejs-build for an example of a build image.
Use these variables for user name, group and home at build time, use $RUN_USER
at run time:
BUILD_USER
: set tocoder
BUILD_GROUP
: set tocoder
BUILD_HOME
: set to/home/coder
Internally used system variables:
LANG
: set to build argument${lang}
, normally set toen_US.UTF-8
PS1
: set to a nice console prompt