From fbf618afd671dc70eb80d37ef26fe51cacfd4434 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 26 Jan 2016 13:30:12 -0800 Subject: [PATCH] Run update.sh --- golang/README.md | 2 ++ nginx/README.md | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/golang/README.md b/golang/README.md index b585e0b76..16a9f3df7 100644 --- a/golang/README.md +++ b/golang/README.md @@ -47,6 +47,8 @@ $ docker build -t my-golang-app . $ docker run -it --rm --name my-running-app my-golang-app ``` +*Note:* the default command in `golang:onbuild` is actually `go-wrapper run`, which includes `set -x` so the binary name is printed to stderr on application startup. If this behavior is undesirable, then adding `CMD ["app"]` (or `CMD ["myapp"]` if a [Go custom import path](https://golang.org/s/go14customimport) is in use) will silence it by running the built binary directly. + ## Compile your app inside the Docker container There may be occasions where it is not appropriate to run your app inside a container. To compile, but not run your app inside the Docker instance, you can write something like: diff --git a/nginx/README.md b/nginx/README.md index 2f8dee295..fe436c8a6 100644 --- a/nginx/README.md +++ b/nginx/README.md @@ -72,6 +72,29 @@ Then, build with `docker build -t some-custom-nginx .` and run: $ docker run --name some-nginx -d some-custom-nginx ``` +### using environment variables in nginx configuration + +Out-of-the-box, Nginx doesn't support using environment variables inside most configuration blocks. But `envsubst` may be used as a workaround if you need to generate your nginx configuration dynamically before nginx starts. + +Here is an example using docker-compose.yml: + +```web: + image: nginx + volumes: + - ./mysite.template:/etc/nginx/conf.d/mysite.template + ports: + - "8080:80" + environment: + - NGINX_HOST=foobar.com + - NGINX_PORT=80 + command: /bin/bash -c "envsubst < /etc/nginx/conf.d/mysite.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" +``` + +The `mysite.template` file may then contain variable references like this : + +`listen ${NGINX_PORT}; +` + # Supported Docker versions This image is officially supported on Docker version 1.9.1.