1

I'm currently debugging a Dockerfile and it would be really helpful if I could print things on the console during the build process.

To be specific: I have two different build-scripts depending on what branch is beeing build and I have to make the distinction inside the Dockerfile. As I understand it, I need to use Powershell syntax to put functionality into the Dockerfile, so I wrote the following:

ARG branch
RUN IF ($branch -eq 'alpha') {./alphabuild.bat}
RUN IF ($branch -eq 'rc') {./rcbuild.bat}

While the syntax finally seems to be correct (I never did Powershell scripting before), it still doesn't actually execute the build script when calling

docker build -t myapp:test --build-arg branch=alpha .

It would be really helpful to be able to print the result of the conditions, or the build argument itself to find out where the bug is.

Edit: Not a duplicate of this question, as I'm building a Windows container and I would really like to print stuff. Had several situations where that would come in handy.

TigersEye120
  • 664
  • 1
  • 9
  • 28
  • Possible duplicate of [Dockerfile if else condition with external arguments](https://stackoverflow.com/questions/43654656/dockerfile-if-else-condition-with-external-arguments) – LinPy Jul 29 '19 at 08:19
  • 1
    I saw that question. Problem is, it's about Linux containers (notice the accepted answer is bash script) and it doesn't touch the subject of printing something during build process. – TigersEye120 Jul 29 '19 at 08:35

0 Answers0