environment

The environment file can be used to store global configuration parameters for your docker-compose file. The file is stored in /etc/environment.

The following configuration is largely based on docker media server how to.

vim /etc/environment

After a standard ubuntu 18.04 installation the environment file probably looks like this

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

User and Group

In my basic setup I create a user cloud and a group cloud that I run docker-compose with, in my environment file I specify the ids of the user and group as parameters.

PUID=1002
PGID=1002

You can get the values for your user via the following command

sudo id cloud

this shoudl output some thing like this

uid=1002(cloud) gid=1002(cloud) groups=1002(cloud)

Time zone

You can add a valiable for your timezone time zones

TZ="Europe/Zurich"

Basic auth

You can specify a basic auth user that you can use to secure pages, you can encode the password as follows

echo $(htpasswd -nb admin supersecret) | sed -e s/\\$/\\$\\$/g

You might need to install some extra dependencies for the apache tools

apt install apache2-utils -y

That would result in some thing as admin:$$apr1$$o6BgYlgS$$U3GfcrYe6/7Ir2bVvVit61 that you could than add as follows

HTTP_USERNAME=admin
HTTP_PASSWORD="$$apr1$$o6Bgbodo@naumann.devYlgS$$U3GfcrYe6/7Ir2bVvVit61"

Clear text password

Some configurations need clear text passwords

U01_CLEAR=bodo
U02_CLEAR=tv
GRP_CLEAR=cloud
P01_CLEAR=supersecret
P02_CLEAR=supersecret

Domain name

You can configure your host name as domain name and reference it in all services, this makes it easy to reuse a docker file on different hosts.

DOMAINNAME="example.com"

DNS Server

The default DNS Server

DNS=192.168.1.254

email address

EMAIL=mail@example.com

Sample

This is a sample based on the parameters above

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
PUID=1002
PGID=1002
TZ="Europe/Zurich"
HTTP_USERNAME=admin
HTTP_PASSWORD="$$apr1$$o6Bgbodo@naumann.devYlgS$$U3GfcrYe6/7Ir2bVvVit61"
U01_CLEAR=bodo
U02_CLEAR=tv
GRP_CLEAR=cloud
P01_CLEAR=supersecret
P02_CLEAR=supersecret
DOMAINNAME="example.com"
DNS=1.1.1.1
EMAIL=mail@example.com

Revision #14
Created 21 November 2019 14:49:15 by Bodo
Updated 24 November 2019 07:06:03 by Bodo