Newbie Q: How to print/capture a file from Dockerfile

Hi all!

In my simple Dockerfile I’d like to cat/print/capture the value of a file.

When I run flyctl deploy with a step like RUN cat file.txt in the Dockerfile, the output gets hidden. I tried NO_COLOR=1 and the --verbose and --debug flags but still don’t see it.

Is there a way to do this?

Thanks!

Recent Docker versions tend to “eat” a lot of the terminal output during the build process. You can ask the builder to use the “old” behavior which is a bit more verbose by disabling BuildKit, and also to ask it to only build the image and not do a deploy while you debug the build process.

DOCKER_BUILDKIT=false fly deploy --build-only

  • Daniel
2 Likes

Perfect, that worked. Thanks Daniel!

@roadmr Thanks for providing the solution here. Can we update the fly deploy docs page with this?

The page currently says:

To disable colorized output and show full Docker build output, set the environment variable NO_COLOR=1.

Which does not work.

From How To to Questions / Help

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.