12

Today I experimented a bit with Dockerfile's.
Was quite surprised how far you could go with a spicy salsa of ARG, ENV, SHELL and multi stage builds.

But... For fucks sake....the debugging is like poking a light year long rod into a black hole, trying to fish something out of the event horizon....

In the end I got a nice setup for Java build's, version injectable with ENV/ARG, non root user and version specific behaviour.

As the debugging is non existing...

I filled up more than once my SSD....

It was an annoying brain damaged repetitive cycle of changing Dockerfile, pruning all images if docker build stopped because of missing free space, waiting for all stages to complete, start new.

And caching is a fragile thing that puzzles me .........

Guess more fishing tomorrow.

*Gives a happy deep throat to the beer bottle in hope of death*

Comments
  • 1
    Debugging docker is pretty straightforward. Every step creates a checkpoint you can run, just use "docker run -ti --rm <checkpoint> sh", then you can do whatever you want, manually try the next command to make sure you got everything right, etc.
  • 3
    @hitko Yes. No.

    Fuckity.

    Yes you could use eg docker run to execute an command inside the last generated docker image in the build stage.

    No. It isn't as simple as that.

    Debugging means a bit more explanation of what the docker commands do.

    Eg when you work with a non root user, you have to use COPY --chown USER:GID .. as permissions get set to root otherwise.

    Behaviour is fine, but it would be
    helpful if that would be _visible_ in the output while running the command. I might have overlooked some verbose flag, but in general these are tiny papercuts that can drive someone insane.....

    Another example...

    Multi build stage - what is inherited in a sub stage? yes.i could look it up or analyze it by docker inspect <Image> -but a simple text output like "ENV, ARG, ENTRY POINT... inherited from XY" would make it obvious....

    Very small things, but pretty nasty.

    Fuckity as sometimes interacting with docker tools it self can be ...painful.

    docker -f Dockerfile build .
    docker build -f Dockerfile .

    Which is correct...? ;)

    All small tiny things...some maybe not fixable, yes.but the error output is most of the times really not helpful.
  • 0
    Make sure that if you're trying what @hitko says that you're not running under buildkit.

    Buildkit debugging is almost impossible, but builds are by and large much faster.
  • 0
    Really useful tool i wish id known earlier: dive.
    Lets you see individual layers in an intuitive way
Add Comment