Easiest way to increase logging within Docker

I am wanting to increase the logging of both the controller and edge router to assist tracking down some problems. However, through Docker there doesn’t seem to be a simple way. From what I have read, you need to start the executable with a -v command to increase the logging. This is difficult with an immutable container, and therefore requires that you modify the command command in docker compose with multiple command to fudge it (haven’t done it yet, but may need too).

There does not seem to be an environment variable for this either. I did see reference to an API that will enable changing on the fly.

Is there a way that I am not finding?

There is no way, I know of, no. I filed allow debug logging to be set on docker containers · Issue #1007 · openziti/ziti · GitHub. I don’t think there’s an environment var you can set. If there is, I’ll reply here. other than that, watch that issue for updates.

thanks for reporting that

When you run a container you may specify things like run-as user, working directory, entrypoint, command, and arguments, among other things. The defaults are specified in the image by building a Dockerfile.

Here’s how you’d customize the args while using the default entrypoint with docker CLI. The approach is similar with Compose, Kubernetes, etc. although they may have slightly different nomenclature for “command”, “args”, etc.

# replace default args ["run"] with custom args 
#  appended to default command ["ziti", "controller"]
docker run --rm \
    openziti/ziti-controller \
    run /path/to/config.yml --verbose

I didn’t understand @qrkourier’s reply just from what he posted above… I had to go look at the entrypoint.sh included in the Docker files to try to understand what he’s saying.

Looking at the new images Docker files from github, we can see that these new images simply call the executable with arguments passed into to running container.

That means whatever args are passed via docker (or whatever) are passed through to the image running. That’s cool. It means you’ll be able to pass the --verbose flag to the command, just like @qrkourier outlined, but you can’t do that with the ‘quickstart’ images we have right now. You’ll have to move over to the new images.

It also means I can close that issue I filed, since we do have support for it :slight_smile:

It’ll work with the quickstart container too. Incidentally, that particular image’s Dockerfile doesn’t specify a run command nor entrypoint, so it’s always necessary to override at least one of those for the container to do anything. Here’s an example of doing the same thing with the quickstart container that I showed earlier with the openziti/ziti-controller image.

docker run --rm \
    openziti/quickstart \
    /var/openziti/ziti-bin/ziti controller run \
        /path/to/config.yml --verbose
1 Like

Well hot dog! :slight_smile: Good to know!