How do you add items to .dockerignore?

前端 未结 8 993
醉话见心
醉话见心 2020-12-29 01:04

I\'m not able to find many examples of what a .dockerignore file should look like.

Using puppet to install a few packages on a docker container causes the image to

8条回答
  •  失恋的感觉
    2020-12-29 02:00

    I think the best solution for your use case is to use a Multi-stage build in your docker file. Your Dockerfile must be in an empty directory, and you run puppet in a disposable container.

    From the link above:

    With multi-stage builds, you use multiple FROM statements in your Dockerfile. Each FROM instruction can use a different base, and each of them begins a new stage of the build. You can selectively copy artifacts from one stage to another, leaving behind everything you don’t want in the final image.

提交回复
热议问题