1

I detected following problem with Kaniko in GitLab CI: Lets say I have this Dockerfile:

FROM nginx:latest
RUN mkdir test

Now I want to create two images from this Dockerfile. When building the second image it fails saying that the directory has been created already.

I think the reson of this has something to do with kanikos build context.

Do you have an idea how I can still build multiple images inside a single pipeline job using Kaniko?

Moritz
  • 307
  • 1
  • 4
  • 10

1 Answers1

1

While it might be linked to the Kaniko build context (since it does not depend on a Docker daemon and executes each command within a Dockerfile completely in userspace), a simple solution would be:

RUN mkdir -p test

That way, even if test already exist, it won't fail in error.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250