From e74c67f77965b8c0cd1bea4d1f1924b2dcebfa07 Mon Sep 17 00:00:00 2001 From: dchaffey Date: Sun, 28 Jan 2018 18:23:58 +0000 Subject: [PATCH] Corrected Docker tag back to standard format Modified Docker startup scripts to accept Environment variables if available, or use the usual defaults if not. Updated readme to reflect changes in allowing environment variables. Updated readme to correctly reflect the default ports that NiFi will run on. This closes #2439 Signed-off-by: Jeremy Dyer --- nifi-docker/dockerhub/DockerImage.txt | 2 +- nifi-docker/dockerhub/README.md | 23 +++++++++++++++++------ nifi-docker/dockerhub/sh/secure.sh | 4 ++-- nifi-docker/dockerhub/sh/start.sh | 8 ++++---- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/nifi-docker/dockerhub/DockerImage.txt b/nifi-docker/dockerhub/DockerImage.txt index 01bc5e64ab..ea348603a6 100644 --- a/nifi-docker/dockerhub/DockerImage.txt +++ b/nifi-docker/dockerhub/DockerImage.txt @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -apachenifi:1.6.0 +apache/nifi:1.6.0 diff --git a/nifi-docker/dockerhub/README.md b/nifi-docker/dockerhub/README.md index d87765e96f..4d9a559449 100644 --- a/nifi-docker/dockerhub/README.md +++ b/nifi-docker/dockerhub/README.md @@ -46,12 +46,22 @@ The configuration scripts are suitable for at least 1.4.0+. The minimum to run a NiFi instance is as follows: docker run --name nifi \ - -p 18080:8080 \ + -p 8080:8080 \ -d \ apache/nifi:latest -This will provide a running instance, exposing the instance UI to the host system on at port 18080, -viewable at `http://localhost:18080/nifi`. +This will provide a running instance, exposing the instance UI to the host system on at port 8080, +viewable at `http://localhost:8080/nifi`. + +You can also pass in environment variables to change the NiFi communication ports and hostname using the Docker '-e' switch as follows: + + docker run --name nifi \ + -p 9090:9090 \ + -d \ + -e NIFI_WEB_HTTP_PORT='9090' + apache/nifi:latest + +For a list of the environment variables recognised in this build, look into the .sh/secure.sh and .sh/start.sh scripts ### Standalone Instance, Two-Way SSL In this configuration, the user will need to provide certificates and the associated configuration information. @@ -62,7 +72,7 @@ Finally, this command makes use of a volume to provide certificates on the host docker run --name nifi \ -v /User/dreynolds/certs/localhost:/opt/certs \ - -p 18443:8443 \ + -p 8443:8443 \ -e AUTH=tls \ -e KEYSTORE_PATH=/opt/certs/keystore.jks \ -e KEYSTORE_TYPE=JKS \ @@ -86,7 +96,7 @@ volume to provide certificates on the host system to the container instance. docker run --name nifi \ -v /User/dreynolds/certs/localhost:/opt/certs \ - -p 18443:8443 \ + -p 8443:8443 \ -e AUTH=tls \ -e KEYSTORE_PATH=/opt/certs/keystore.jks \ -e KEYSTORE_TYPE=JKS \ @@ -115,7 +125,7 @@ volume to provide certificates on the host system to the container instance. -e LDAP_TLS_TRUSTSTORE_TYPE: '' ## Configuration Information -The following ports are specified by the Docker container for NiFi operation within the container and +The following ports are specified by default in Docker for NiFi operation within the container and can be published to the host. | Function | Property | Port | @@ -123,3 +133,4 @@ can be published to the host. | HTTP Port | nifi.web.http.port | 8080 | | HTTPS Port | nifi.web.https.port | 8443 | | Remote Input Socket Port | nifi.remote.input.socket.port | 10000 | + diff --git a/nifi-docker/dockerhub/sh/secure.sh b/nifi-docker/dockerhub/sh/secure.sh index 4609005396..919e11817e 100644 --- a/nifi-docker/dockerhub/sh/secure.sh +++ b/nifi-docker/dockerhub/sh/secure.sh @@ -48,8 +48,8 @@ prop_replace 'nifi.security.truststorePasswd' "${TRUSTSTORE_PASSWORD}" # Disable HTTP and enable HTTPS prop_replace 'nifi.web.http.port' '' prop_replace 'nifi.web.http.host' '' -prop_replace 'nifi.web.https.port' '8443' -prop_replace 'nifi.web.https.host' "${hostname}" +prop_replace 'nifi.web.https.port' "${NIFI_WEB_HTTPS_PORT:-8443}" +prop_replace 'nifi.web.https.host' "${NIFI_WEB_HTTPS_HOST:-$HOSTNAME}" prop_replace 'nifi.remote.input.secure' 'true' # Establish initial user and an associated admin identity diff --git a/nifi-docker/dockerhub/sh/start.sh b/nifi-docker/dockerhub/sh/start.sh index df79ad6de7..7e340a60fc 100755 --- a/nifi-docker/dockerhub/sh/start.sh +++ b/nifi-docker/dockerhub/sh/start.sh @@ -20,10 +20,10 @@ scripts_dir='/opt/nifi/scripts' [ -f "${scripts_dir}/common.sh" ] && . "${scripts_dir}/common.sh" # Establish baseline properties -prop_replace 'nifi.web.http.port' '8080' -prop_replace 'nifi.web.http.host' "${hostname}" -prop_replace 'nifi.remote.input.host' "${hostname}" -prop_replace 'nifi.remote.input.socket.port' '10000' +prop_replace 'nifi.web.http.port' "${NIFI_WEB_HTTP_PORT:-8080}" +prop_replace 'nifi.web.http.host' "${NIFI_WEB_HTTP_HOST:-$HOSTNAME}" +prop_replace 'nifi.remote.input.host' "${NIFI_REMOTE_INPUT_HOST:-$HOSTNAME}" +prop_replace 'nifi.remote.input.socket.port' "${NIFI_REMOTE_INPUT_SOCKET_PORT:-10000}" prop_replace 'nifi.remote.input.secure' 'false' # Check if we are secured or unsecured