Search code examples
dockerstdoutstderr

Can I rely on output from Docker?


Can I rely on output from docker run ... that its stdout is only stdout of the software that runs inside and nothing other (no additional output from Docker itself)? similarly for stderr?


Solution

  • If a docker command fails, it will typically produce output on stderr. If the docker command does not fail, then yes output should only be the passed through output from the container.

    You can reduce the number of places errors can happen by creating the container disconnected, verifying the container is running or has run, and then showing logs with docker logs which will give a non-zero exit if the output isn't log output.