From 2ecc4e17758c79b7a85d805cf83728b34a956ada Mon Sep 17 00:00:00 2001 From: Martin Etmajer Date: Thu, 20 Jul 2017 18:04:30 +0200 Subject: [PATCH] Add instructions on how to inject custom environment variables into a container. Closes: #1053 Approved by: rhatdan --- docs/atomic-run.1.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/atomic-run.1.md b/docs/atomic-run.1.md index 552ab9c..e9b6014 100644 --- a/docs/atomic-run.1.md +++ b/docs/atomic-run.1.md @@ -54,6 +54,16 @@ These defaults are suggested values for your container images. **RUN_OPTS** Content of file specified by `LABEL RUN_OPTS_FILE`. During `atomic install`, the `install.sh` can populate the file with any additional options that need to be passed to `docker run`, for example `--hostname=www.example.test` or `--net host`. The file name undergoes environment variable expansion, so for example `LABEL RUN_OPTS_FILE '/var/lib/${NAME}/docker-run-opts'` can be used to store per-container configuration. +Custom environment variables can be provided to the container through the LABEL RUN instruction as follows: + +`LABEL RUN /usr/bin/docker run -t -i --rm -e FOO="\${FOO:-bar}" -v \${LOGDIR}:/var/log -v \${DATADIR}:/var/lib --name \${NAME} \${IMAGE}` + +`atomic run` will run the following: + +`/usr/bin/docker run -t -i --rm -e FOO="${FOO:-bar}" -v ${LOGDIR}:/var/log -v ${DATADIR}:/var/lib --name ${NAME} ${IMAGE}` + +The value of `FOO` can be set explicitly via `FOO=baz atomic run`. + # OPTIONS: **-h** **--help** Print usage statement