baseimage
is inspired by phusion/baseimage-docker. It uses same directory layout for defining services, patched versions ofmy_init
andsetuser
(but compatible with original one), but, build from scratch.
- Ubuntu 16.04 LTS
- Tiny size and low memory footprint
- Painless deploy
- Prebuilt images:
- my_init - boot manager
- my_wait - dependency manager, a-la wait-for-it
- runit - process supervisor
- nginx - reverse proxy service, disabled by default
- msmtp - smtp relay/sendmail service, disabled by default
- bcron - cron service, disabled by default
- ansible
- htop, replaces
top
- psmisc, replaces
ps
- vim.tiny
- net-tools
- make
- curl
- less
- tzdata
- ca-certificates
Beware,
baseimage
doesn't containtop
andps
commands due Ubuntu's dependencies. Commandshtop
andpstree
provided as replacements.
- Preconfigured locales:
en_US.UTF-8
,ru_RU.UTF-8
- Default LANG/LC_ALL:
en_US.UTF-8
- Default timezone:
Europe/Moscow
- wait:
/etc/my_wait.d/*
- run:
/etc/my_init.d/*
- run:
/etc/rc.local
- run:
/sbin/runit
- wait:
/etc/service/*/check
Every wait script should exit with code:
0
— ready, no further call required1
— wait, subsequent call required
Global wait timeout covering all scripts in phase.
Do not put sleep
or loop
inside of wait script, script should
check condition and return asap.
Global timeout for each wait
phase can be configured independently:
(--wait-resources-timeout
for /etc/my_wait.d/
and --wait-services-timeout
for /etc/service/*/check
). Default value for each timeout is 30 seconds.
If /etc/my_wait.d/*
or /etc/service/*/check
exceed global timeout,
container will refuse to start.
Beware, due nature of script running, all checks will be executed at least once, even if one check is already violated timeout.
If any of /etc/my_init.d/*
, /etc/rc.local
exits with non-zero exit code,
container will refuse to start.
Once all wait
and run
phases of boot sequence are finished,
container considered alive. No further checks will run.
For alive container, on terminate/kill signal, shutdown sequence will run:
- run:
/etc/my_init.pre_shutdown.d/*
- kill: runit
- run:
/etc/my_init.post_shutdown.d/*
Each phase will run only if previous finished gracefully.
/sbin/setuser username command [arguments]
Command environment will be explicitly filled with container defined
environment variables. Variables filled without overwriting, so,
call NODE_ENV=staging /sbin/setuser env | grep NODE_ENV
will print
staging
no matter what is defined in /etc/container_environment/NODE_ENV
.
- Repository: official
- Dockerfile:
RUN /sbin/enable_service cron
- Configure:
/etc/crontab
Beware,
cron
will run tasks with reduced set of environment variables, if your script need access to all container environment variables, run task via/sbin/setuser
command.
Sample /etc/crontab
file:
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# script WITH container environment variables
* * * * * root /sbin/setuser nobody /app/app_cron.sh
# script WITHOUT container environment variables
* * * * * root /app/system_cleanup.sh
- Repository: official
- Dockerfile:
RUN /sbin/enable_service sendmail
- Configure: provide environment variables on container start:
SENDMAIL_HOST
- ip address or domain name of SMTP serverSENDMAIL_PORT
- override smtp port, default is25
SENDMAIL_DOMAIN
- force outboundfrom:
Sample docker run
command:
docker run --rm \
-e SENDMAIL_HOST="mail.example.com" \
...
- Repository: nginx/stable
- Dockerfile:
RUN /sbin/enable_service nginx
- Configure:
- create project config (with
.conf
extension) in/etc/nginx/virtuals
directory - if default config is not suitable,
just create desired
/etc/nginx/nginx.conf
, baseimage will not override it.
- create project config (with
Do not use
daemon off
, run script will provide this option by default.
Image is squashed, so actually it contains only two layers.
- Node.js 6 Maintenance LTS
- Yarn
docker pull dalee/nodejs-6
Image is squashed, so actually it contains only two layers.
- Node.js 8 Active LTS
- Yarn
docker pull dalee/nodejs-8
Image is squashed, so actually it contains only two layers.
- PHP 5.6
- Composer
- XDebug extension (disabled by default)
docker pull dalee/php-5.6
Image is squashed, so actually it contains only two layers.
- PHP 7.1
- Composer
- XDebug extension (disabled by default)
docker pull dalee/php-7.1
Image is squashed, so actually it contains only two layers.
- PHP 7.2
- Composer
- XDebug extension (disabled by default)
docker pull dalee/php-7.2
latest
— latestmaster
branchvX.Y.Z
— tagged release