Restore functionality in docker entrypoint #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In speaking further with Johannes, he recalled the original functionality allowed for starting something in the container that was not our daemon.
I removed the last clause of the case statement to not assume that our daemon will be run and to allow the caller to run another command besides newrelic-daemon. It functionally behaves like the previous (non POSIX compatible) entry point.
However…
The functionality of this(old and new) is somewhat limited because it only works for commands that don't use preceding flags. For instance, both instances can run a command the following:
and
And you'll see the output in the logs. However, if you try to call any command that uses flags preceding the command, like:
We call the newrelic daemon with all flags and anything following the flags, so we'd call
newrelic-daemon
with-lt /bin/sh
arguments.The three use cases are then:
. Running the daemon with the full path:
docker run -d --name $name c-daemon /usr/bin/newrelic-daemon --loglevel debug
. Running the daemon without specifying the daemon binary:
docker run -d --name $name c-daemon --loglevel debug
. Running an arbitrary command that is NOT preceded by a flag:
docker run -d --name $name c-daemon cat /var/log/newrelic-daemon.log
This has been tested by
tests/image_tests.sh
.image_tests.sh
has also been updated to test functionality of usage case #3.