-
Notifications
You must be signed in to change notification settings - Fork 370
Docker network option #1496
Docker network option #1496
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 small point to correct.
Hi @sadjy , thanks. Changes
Docker Build outputAll the ENVs configured on a single layer (step 10/12):
Explanation about entrypoint changeRegarding the Test ExamplesIn order to test, this is an "override" entrypoint script that copies the jar file into a directory with space in the name: #!/bin/bash
# See Dockerfile and DOCKER.md for further info
if [ "${DOCKER_IRI_MONITORING_API_PORT_ENABLE}" == "1" ]; then
nohup socat -lm TCP-LISTEN:14266,fork TCP:127.0.0.1:${DOCKER_IRI_MONITORING_API_PORT_DESTINATION} &
fi
# Just as temporary test, make sure we actually
# have something in a
mkdir -p "/iri/target hello/"
cp "/iri/target/iri-1.7.0-DEV-1844bec.jar" "/iri/target hello/"
IRI_JAR_FILE=$(find "$DOCKER_IRI_JAR_PATH" -type f -name "$DOCKER_IRI_JAR_FILE" -print -quit)
if [[ "${IRI_JAR_FILE}x" == "x" ]]
then
>&2 echo "ERROR: File '$DOCKER_IRI_JAR_FILE' not found in path '$DOCKER_IRI_JAR_PATH'"
exit 1
fi
# Let's output what file was found
echo "$IRI_JAR_FILE"
exec java \
$JAVA_OPTIONS \
-Xms$JAVA_MIN_MEMORY \
-Xmx$JAVA_MAX_MEMORY \
-Djava.net.preferIPv4Stack=true \
-jar "$IRI_JAR_FILE" \
--remote "$DOCKER_IRI_REMOTE" --remote-limit-api "$DOCKER_IRI_REMOTE_LIMIT_API" \
"$@" Setting awkward charactersDocker run and set the path in environment variable: # docker run --rm -it -v $(pwd)/entrypoint.sh:/entrypoint.sh -e DOCKER_IRI_JAR_PATH="/iri/target hello/" -e DOCKER_IRI_JAR_FILE="iri*.jar" test:nuri
/iri/target hello/iri-1.7.0-DEV-1844bec.jar
Logging - property 'logging-level' set to: [INFO]
06/18 11:27:17.906 [main] INFO IRI$IRILauncher:188 - Configuration is created using command line args only
06/18 11:27:17.912 [main] INFO IRI$IRILauncher:189 - parsed the following cmd args: [--remote, true, --remote-limit-api, interruptAttachToTangle, attachToTangle, addNeighbors, removeNeighbors, getNeighbors]
06/18 11:27:17.916 [main] INFO IRI$IRILauncher:119 - Welcome to IRI 1.7.0-DEV-${git.commit.id.abbrev} This should work for any "awkward" characters (quotes, $, *, etc...)
File not foundIf file is not found: root@snap:/home/nuriel# docker run --rm -it -e DOCKER_IRI_JAR_PATH='/iri/target*hello/' -e DOCKER_IRI_JAR_FILE="iri*.jar" test:nuri
find: '/iri/target*hello/': No such file or directory
ERROR: File 'iri*.jar' not found in path '/iri/target*hello/'
root@snap:/home/nuriel# docker run --rm -it -e DOCKER_IRI_JAR_PATH='/iri/target/' -e DOCKER_IRI_JAR_FILE="i_am_no_here.jar" test:nuri
ERROR: File 'i_am_no_here.jar' not found in path '/iri/target/' Using defaultsroot@snap:/home/nuriel# docker run --rm -it test:nuri
Logging - property 'logging-level' set to: [INFO]
06/18 12:53:42.827 [main] INFO IRI$IRILauncher:188 - Configuration is created using command line args only
06/18 12:53:42.832 [main] INFO IRI$IRILauncher:189 - parsed the following cmd args: [--remote, true, --remote-limit-api, interruptAttachToTangle, attachToTangle, addNeighbors, removeNeighbors, getNeighbors]
06/18 12:53:42.834 [main] INFO IRI$IRILauncher:119 - Welcome to IRI 1.7.0-DEV-${git.commit.id.abbrev} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @nuriel77, brilliant! Thank you for your very much appreciated contribution. :)
Hi @sadjy ... About this last commit: this kind of came up recently that users wanted to use IPv6. By passing
|
@nuriel77 So it will be in IRI 1.8.1. If you have good reasons to think it should be in 1.8.0, you can voice them and I may reconsider :-) |
@GalRogozinski Thanks. There is no urgency. If someone was to complain about wanting to bind to some specific interface/IPv6 I can help them setup a custom entrypoint script, that should solve it. |
Description
The current hard coded configuration of
--remote true
seems based on the premise that a user should want to run IRI docker container in a bridged network. (this configuration ensures that IRI listens on 0.0.0.0 and is therefore available for NAT).Should a user prefer to run IRI on the host network, it seems useful to have the option to set
--remote
to false, thereby retaining the same behavior of a non-dockerized IRI, binding API port to localhost of the host.With regards to why a user should choose to run IRI on host network the main reason is performance:
From https://docs.docker.com/engine/reference/run/#network-settings
In addition to making the
--remote
option configurable, thejava.net.preferIPv4Stack
option has also been made configurable. And I have done some improvements on the Dockerfile and documentation. Details are in comments below.Type of change
How Has This Been Tested?
Tested by starting up with the variable, also tested overriding the default variable in docker cli.
Checklist: