Skip to content

Latest commit

 

History

177 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nightly Builds Release to Docker Registries

Flownative Docker Base Image

A Docker base image, derived from the official debian "slim" image, integrated into the build pipeline of Flownative Docker images.

Up to v3.x this image was derived from bitnami/minideb; the v4.x line (trixie-slim tag) is based on debian:trixie-slim instead. See docs/trixie-slim-crossgrade.md for the background and the migration notes.

Installing packages

Images building on this base can install Debian packages either through the packages_install function of the bash library found in $FLOWNATIVE_LIB_PATH/packages.sh, or through the install_packages script, which behaves like the one formerly provided by minideb: it retries failed downloads, skips recommended packages and cleans the APT caches afterwards.

install_packages curl jq

A few defaults are baked into the image which derived images inherit during their builds:

  • APT never installs recommended or suggested packages and retries failed downloads (/etc/apt/apt.conf.d/01-flownative)
  • packages are fetched via HTTPS
  • daemons installed during a build are kept from starting by a /usr/sbin/policy-rc.d guard
  • documentation, man pages and locales are excluded via dpkg path-excludes
  • packages which serve no purpose in a container (mount, login, ncurses-bin, hostname, the cron daemon) are removed
  • all setuid/setgid bits are removed and pinned via dpkg-statoverride, so upgrades of those packages in derived images do not restore them; note that packages installed in derived images may bring their own setuid binaries (openssh-client's ssh-agent, for example) — stripping those is the derived image's responsibility

Init

This image contains a simple mechanism for automatic execution of init-scripts when the container is started.

When included, the init.sh script is used as an ENTRYPOINT of your Docker container, it scans the directory /opt/flownative/init/etc/init.d for .sh files. The scripts are then called in an alphabetical order, so it makes sense to prefix filenames with a number, if the order is important.

The init.d directory might contain files like these:

3_test.sh
10_another_test.sh
20_yet_another_test.sh

Supervisor

This image contains Supervisor, a tool for running and watching Linux processes. We use Supervisor in extensions of this image for running services like Nginx, PHP-FPM, SSHD and the like.

Supervisor is started by calling the respective functions of the supervisor.sh bash library:

. "${FLOWNATIVE_LIB_PATH}/supervisor.sh"

eval "$(supervisor_env)"
supervisor_initialize
supervisor_start

trap 'supervisor_stop' SIGINT SIGTERM
supervisor_pid=$(supervisor_get_pid)

# We can't use "wait" because supervisord is not a direct child of
# this shell:
while [ -e "/proc/${supervisor_pid}" ]; do sleep 1.1; done

Take a look at the init.sh script used as an ENTRYPOINT in this image for more context.

Supervisor will look for configuration files in /opt/flownative/supervisor/etc/conf.d/. Add your own files in order to configure supervisord and use supervisorctl to control it.

syslog-ng

This image contains syslog-ng, a tool for processing logs of Linux processes. We use syslog-ng for collecting logs from the application(s) running in the container and output them to the console. This way you can see all logs via docker logs or through other tools fetching logs from STDOUT / STDERR and further log files.

The application extending this image may add additional syslog-ng configuration by adding a file to $SYSLOG_BASE_PATH/etc/conf.d. The file should be named after the application (for example "nginx.conf").

Note that the include file must not be a complete syslog-ng configuration file, which means that if it starts with a "@version" statement, it will not be included (see documentation).

Within configuration files you can easily use global environment variables using the backtick syntax:

    source s_nginx_common {
           file("`FLOWNATIVE_LOG_PATH`/nginx_*.log");
    };

You can check the actual "rendered" configuration by running the following command from a bash within the container:

    syslog-ng-ctl config -p

Building this image

Build this image with docker build.

About

Flownative Docker Base Image

Topics

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages