Skip to content

Commit

Permalink
Merge branch 'stable' into ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
BertrandGouny committed Nov 8, 2016
2 parents ba0b2af + ce924c7 commit 5f7f2df
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 35 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.1.8
- Add to the 'run' tool option --dont-touch-etc-hosts Don't add in /etc/hosts a line with the container ip and $HOSTNAME environment variable value.
- Fix wait-process script

## 0.1.7
- Fix is_runit_installed check /usr/bin/sv instead of /sbin/runit #6
- Upgrade cfssl 1.2.0
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME = osixia/ubuntu-light-baseimage
VERSION = 0.1.7
VERSION = 0.1.8

.PHONY: all build build-nocache test tag_latest release

Expand Down
53 changes: 33 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

[hub]: https://hub.docker.com/r/osixia/ubuntu-light-baseimage/

Latest release: 0.1.7 - [Changelog](CHANGELOG.md)
Latest release: 0.1.8 - [Changelog](CHANGELOG.md)
| [Docker Hub](https://hub.docker.com/r/osixia/ubuntu-light-baseimage/) 

A Ubuntu Trusty (14:04) based docker image to build reliable image quickly. This image provide a simple opinionated solution to build multiple or single process image with minimum of layers and an optimized build.
Expand Down Expand Up @@ -41,7 +41,7 @@ Table of Contents
- [Advanced User Guide](#advanced-user-guide)
- [Service available](#service-available)
- [Fix docker mounted file problems](#fix-docker-mounted-file-problems)
- [Distribution packages documentation and locales](#distribution-packages-documentation-and-locales)
- [Distribution packages documentation and locales](#distribution-packages-documentation-and-locales)
- [Mastering image tools](#mastering-image-tools)
- [run](#run)
- [Run command line options](#run-command-line-options)
Expand Down Expand Up @@ -143,7 +143,7 @@ In the Dockerfile we are going to:

# Use osixia/ubuntu-light-baseimage
# https://github.com/osixia/docker-light-baseimage
FROM osixia/ubuntu-light-baseimage:0.1.7
FROM osixia/ubuntu-light-baseimage:0.1.8
MAINTAINER Your Name <[email protected]>

# Download nginx from apt-get and clean apt-get files
Expand Down Expand Up @@ -386,7 +386,7 @@ In the Dockerfile we are going to:

# Use osixia/ubuntu-light-baseimage
# https://github.com/osixia/docker-light-baseimage
FROM osixia/ubuntu-light-baseimage:0.1.7
FROM osixia/ubuntu-light-baseimage:0.1.8
MAINTAINER Your Name <[email protected]>

# Install multiple process stack, nginx and php5-fpm and clean apt-get files
Expand Down Expand Up @@ -519,6 +519,7 @@ Single process images:
- [osixia/tinc](https://github.com/osixia/docker-tinc)
- [osixia/registry-ldap-auth](https://github.com/osixia/docker-registry-ldap-auth)
- [osixia/cfssl-multirootca](https://github.com/osixia/docker-cfssl-multirootca)
- [osixia/backup](https://github.com/osixia/docker-backup)
- [osixia/backup-manager](https://github.com/osixia/docker-backup-manager)
- [osixia/mmc-agent](https://github.com/osixia/docker-mmc-agent)

Expand All @@ -527,14 +528,18 @@ Multiple process images:
- [osixia/mariadb](https://github.com/osixia/docker-mariadb)
- [osixia/wordpress](https://github.com/osixia/docker-wordpress)
- [osixia/roundcube](https://github.com/osixia/docker-roundcube)
- [osixia/piwik](https://github.com/osixia/docker-piwik)
- [osixia/phpMyAdmin](https://github.com/osixia/docker-phpMyAdmin)
- [osixia/phpLDAPadmin](https://github.com/osixia/docker-phpLDAPadmin)
- [osixia/kubernetes-reverseproxy](https://github.com/osixia/kubernetes-reverseproxy)
- [osixia/keepalived-confd](https://github.com/osixia/docker-keepalived-confd)
- [osixia/tinc-etcd](https://github.com/osixia/docker-tinc-etcd)
- [osixia/postfix-gateway-confd](https://github.com/osixia/docker-postfix-gateway-confd)
- [osixia/mmc-mail](https://github.com/osixia/docker-mmc-mail)
- [osixia/mmc-web](https://github.com/osixia/docker-mmc-web)

Image adding light-baseimage tools to an existing image
- [osixia/gitlab](https://github.com/osixia/docker-gitlab)

Send me a message to add your image in this list.

## Image Assets
Expand Down Expand Up @@ -579,7 +584,7 @@ Here simple Dockerfile example how to add a service-available to an image:

# Use osixia/ubuntu-light-baseimage
# https://github.com/osixia/docker-light-baseimage
FROM osixia/ubuntu-light-baseimage:0.1.7
FROM osixia/ubuntu-light-baseimage:0.1.8
MAINTAINER Your Name <[email protected]>

# Add cfssl and cron service-available
Expand Down Expand Up @@ -628,7 +633,7 @@ So to always apply sed on the correct file in the startup script the command bec

### Distribution packages documentation and locales

This image has a configuration to prevent documentation and locales to be installed from base distribution packages repositories. If you need the doc and locales remove the following files :
This image has a configuration to prevent documentation and locales to be installed from base distribution packages repositories to make it more lightweight as possible. If you need the doc and locales remove the following files :
**/etc/dpkg/dpkg.cfg.d/01_nodoc** and **/etc/dpkg/dpkg.cfg.d/01_nolocales**


Expand All @@ -649,10 +654,11 @@ What it does:

*Run tool* takes several options, to list them:

docker run osixia/ubuntu-light-baseimage:0.1.7 --help
usage: run [-h] [-e] [-s] [-p] [-f] [-o {startup,process,finish}] [-c COMMAND]
[-k] [--copy-service] [--wait-first-startup]
[--wait-state FILENAME] [--keep-startup-env] [--keepalive]
docker run osixia/ubuntu-light-baseimage:0.1.8 --help
usage: run [-h] [-e] [-s] [-p] [-f] [-o {startup,process,finish}]
[-c COMMAND [WHEN={startup,process,finish} ...]] [-k]
[--wait-state FILENAME] [--wait-first-startup] [--keep-startup-env]
[--copy-service] [--dont-touch-etc-hosts] [--keepalive]
[--keepalive-force] [-l {none,error,warning,info,debug,trace}]
[MAIN_COMMAND [MAIN_COMMAND ...]]

Expand All @@ -675,27 +681,34 @@ What it does:
Skip running container finish file(s).
-o {startup,process,finish}, --run-only {startup,process,finish}
Run only this file type and ignore others.
-c COMMAND, --cmd COMMAND
Run this command before startup files.
-c COMMAND [WHEN={startup,process,finish} ...], --cmd COMMAND [WHEN={startup,process,finish} ...]
Run this command before WHEN file(s). Default before
startup file(s).
-k, --no-kill-all-on-exit
Don't kill all processes on the system upon exiting.
--copy-service Copy /container/service to /container/run/service
--wait-first-startup Wait until the first startup is done before starting.
Usefull when 2 containers share /container/run
directory via volume.
--wait-state FILENAME
Wait until the container state file exists in
/container/run/state directory before starting.
Usefull when 2 containers share /container/run
directory via volume.
--wait-first-startup Wait until the first startup is done before starting.
Usefull when 2 containers share /container/run
directory via volume.
--keep-startup-env Don't remove ('.startup.yaml', '.startup.json')
environment files after startup scripts.
--copy-service Copy /container/service to /container/run/service.
Help to fix docker mounted files problems.
--dont-touch-etc-hosts
Don't add in /etc/hosts a line with the container ip
and $HOSTNAME environment variable value.
--keepalive Keep alive container if all startup files and process
exited without error.
--keepalive-force Keep alive container in all circonstancies.
-l {none,error,warning,info,debug,trace}, --loglevel {none,error,warning,info,debug,trace}
Log level (default: info)

Osixia! Light Baseimage: https://github.com/osixia/docker-light-baseimage


##### Run directory setup
*Run tool* will create if they not exists the following directories:
Expand Down Expand Up @@ -752,7 +765,7 @@ If a main command is set for example:
If a main command is set *run tool* launch it otherwise bash is launched.
Example:

docker run -it osixia/ubuntu-light-baseimage:0.1.7
docker run -it osixia/ubuntu-light-baseimage:0.1.8


##### Extra environment variables
Expand Down Expand Up @@ -828,8 +841,8 @@ Note this yaml definition:

Can also be set by command line converted in python or json:

docker run -it --env FRUITS="#PYTHON2BASH:['orange','apple']" osixia/ubuntu-light-baseimage:0.1.7 printenv
docker run -it --env FRUITS="#JSON2BASH:[\"orange\",\"apple\"]" osixia/ubuntu-light-baseimage:0.1.7 printenv
docker run -it --env FRUITS="#PYTHON2BASH:['orange','apple']" osixia/ubuntu-light-baseimage:0.1.8 printenv
docker run -it --env FRUITS="#JSON2BASH:[\"orange\",\"apple\"]" osixia/ubuntu-light-baseimage:0.1.8 printenv

### Tests

Expand Down
2 changes: 1 addition & 1 deletion example/multiple-process-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Use osixia/ubuntu-light-baseimage
# https://github.com/osixia/docker-light-baseimage
FROM osixia/ubuntu-light-baseimage:0.1.7
FROM osixia/ubuntu-light-baseimage:0.1.8
MAINTAINER Your Name <[email protected]>

# Install multiple process stack, nginx and php5-fpm and clean apt-get files
Expand Down
2 changes: 1 addition & 1 deletion example/single-process-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Use osixia/ubuntu-light-baseimage
# https://github.com/osixia/docker-light-baseimage
FROM osixia/ubuntu-light-baseimage:0.1.7
FROM osixia/ubuntu-light-baseimage:0.1.8
MAINTAINER Your Name <[email protected]>

# Download nginx from apt-get and clean apt-get files
Expand Down
22 changes: 13 additions & 9 deletions image/tool/run
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ def set_env_hostname_to_etc_hosts():
with open('/etc/hostname', 'r') as f:
etc_hostname = f.readline().rstrip()

ip_address = socket.gethostbyname(etc_hostname)

if os.environ["HOSTNAME"] != etc_hostname:
ip_address = socket.gethostbyname(etc_hostname)
with open("/etc/hosts", "a") as myfile:
myfile.write(ip_address+" "+os.environ["HOSTNAME"]+"\n")
except:
Expand Down Expand Up @@ -768,7 +767,9 @@ def main(args):
info(ENVIRONMENT_LOG_LEVEL_KEY + " = " + xstr(log_level) + " (" + log_level_switcher_inv.get(log_level) + ")")
state_reset_startup_done()

set_env_hostname_to_etc_hosts()
if args.set_env_hostname_to_etc_hosts:
set_env_hostname_to_etc_hosts()

wait_states(args.wait_states)
setup_run_directories(args)

Expand Down Expand Up @@ -823,18 +824,21 @@ parser.add_argument('-c', '--cmd', metavar=('COMMAND', 'WHEN={startup,process,fi
parser.add_argument('-k', '--no-kill-all-on-exit', dest = 'kill_all_on_exit',
action = 'store_const', const = False, default = True,
help = 'Don\'t kill all processes on the system upon exiting.')
parser.add_argument('--copy-service', dest = 'copy_service',
action = 'store_const', const = True, default = False,
help = 'Copy '+IMPORT_SERVICE_DIR+' to '+RUN_SERVICE_DIR)
parser.add_argument('--wait-first-startup', dest = 'wait_first_startup',
action = 'store_const', const = True, default = False,
help = 'Wait until the first startup is done before starting. Usefull when 2 containers share '+RUN_DIR+' directory via volume.')
parser.add_argument('--wait-state', metavar = 'FILENAME', dest = 'wait_states', type = str,
action = 'append', default=[],
help = 'Wait until the container state file exists in '+RUN_STATE_DIR+' directory before starting. Usefull when 2 containers share '+RUN_DIR+' directory via volume.')
parser.add_argument('--wait-first-startup', dest = 'wait_first_startup',
action = 'store_const', const = True, default = False,
help = 'Wait until the first startup is done before starting. Usefull when 2 containers share '+RUN_DIR+' directory via volume.')
parser.add_argument('--keep-startup-env', dest = 'keep_startup_env',
action = 'store_const', const = True, default = False,
help = 'Don\'t remove ' + xstr(ENV_FILES_STARTUP_EXTENSIONS) + ' environment files after startup scripts.')
parser.add_argument('--copy-service', dest = 'copy_service',
action = 'store_const', const = True, default = False,
help = 'Copy '+IMPORT_SERVICE_DIR+' to '+RUN_SERVICE_DIR+'. Help to fix docker mounted files problems.')
parser.add_argument('--dont-touch-etc-hosts', dest = 'set_env_hostname_to_etc_hosts',
action = 'store_const', const = False, default = True,
help = 'Don\'t add in /etc/hosts a line with the container ip and $HOSTNAME environment variable value.')
parser.add_argument('--keepalive', dest = 'keepalive',
action = 'store_const', const = True, default = False,
help = 'Keep alive container if all startup files and process exited without error.')
Expand Down
4 changes: 1 addition & 3 deletions image/tool/wait-process
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/bin/sh -e

. /container/run/environment.sh

# wait startup to finish
while ! test -f ${CONTAINER_STATE_DIR}/startup-done
while ! test -f /container/run/state/startup-done
do
sleep 0.5
done
Expand Down

0 comments on commit 5f7f2df

Please sign in to comment.