diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d4b5313..583fb34b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.2.6 + - 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.2.5 - Fix is_runit_installed check /usr/bin/sv instead of /sbin/runit #6 - Upgrade cfssl 1.2.0 diff --git a/Makefile b/Makefile index b50372c5..7d84012b 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ NAME = osixia/light-baseimage -VERSION = 0.2.5 +VERSION = 0.2.6 .PHONY: all build build-nocache test tag_latest release diff --git a/README.md b/README.md index 4276647b..99fa4acc 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [hub]: https://hub.docker.com/r/osixia/light-baseimage/ -Latest release: 0.2.5 - [Changelog](CHANGELOG.md) +Latest release: 0.2.6 - [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/light-baseimage/)  A Debian Jessie 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. @@ -143,7 +143,7 @@ In the Dockerfile we are going to: # Use osixia/light-baseimage # https://github.com/osixia/docker-light-baseimage - FROM osixia/light-baseimage:0.2.5 + FROM osixia/light-baseimage:0.2.6 MAINTAINER Your Name # Download nginx from apt-get and clean apt-get files @@ -386,7 +386,7 @@ In the Dockerfile we are going to: # Use osixia/light-baseimage # https://github.com/osixia/docker-light-baseimage - FROM osixia/light-baseimage:0.2.5 + FROM osixia/light-baseimage:0.2.6 MAINTAINER Your Name # Install multiple process stack, nginx and php5-fpm and clean apt-get files @@ -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) @@ -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 @@ -579,7 +584,7 @@ Here simple Dockerfile example how to add a service-available to an image: # Use osixia/light-baseimage # https://github.com/osixia/docker-light-baseimage - FROM osixia/light-baseimage:0.2.5 + FROM osixia/light-baseimage:0.2.6 MAINTAINER Your Name # Add cfssl and cron service-available @@ -649,10 +654,11 @@ What it does: *Run tool* takes several options, to list them: - docker run osixia/light-baseimage:0.2.5 --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/light-baseimage:0.2.6 --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 ...]] @@ -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: @@ -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/light-baseimage:0.2.5 + docker run -it osixia/light-baseimage:0.2.6 ##### Extra environment variables @@ -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/light-baseimage:0.2.5 printenv - docker run -it --env FRUITS="#JSON2BASH:[\"orange\",\"apple\"]" osixia/light-baseimage:0.2.5 printenv + docker run -it --env FRUITS="#PYTHON2BASH:['orange','apple']" osixia/light-baseimage:0.2.6 printenv + docker run -it --env FRUITS="#JSON2BASH:[\"orange\",\"apple\"]" osixia/light-baseimage:0.2.6 printenv ### Tests diff --git a/example/multiple-process-image/Dockerfile b/example/multiple-process-image/Dockerfile index 939b58c2..64605992 100644 --- a/example/multiple-process-image/Dockerfile +++ b/example/multiple-process-image/Dockerfile @@ -1,6 +1,6 @@ # Use osixia/light-baseimage # https://github.com/osixia/docker-light-baseimage -FROM osixia/light-baseimage:0.2.5 +FROM osixia/light-baseimage:0.2.6 MAINTAINER Your Name # Install multiple process stack, nginx and php5-fpm and clean apt-get files diff --git a/example/single-process-image/Dockerfile b/example/single-process-image/Dockerfile index 8e897bd4..819200f2 100644 --- a/example/single-process-image/Dockerfile +++ b/example/single-process-image/Dockerfile @@ -1,6 +1,6 @@ # Use osixia/light-baseimage # https://github.com/osixia/docker-light-baseimage -FROM osixia/light-baseimage:0.2.5 +FROM osixia/light-baseimage:0.2.6 MAINTAINER Your Name # Download nginx from apt-get and clean apt-get files diff --git a/image/tool/run b/image/tool/run index 9b456ade..46219b21 100755 --- a/image/tool/run +++ b/image/tool/run @@ -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: @@ -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) @@ -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.') diff --git a/image/tool/wait-process b/image/tool/wait-process index 6d882b48..3ad9f3ec 100755 --- a/image/tool/wait-process +++ b/image/tool/wait-process @@ -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