How do you add items to .dockerignore?

前端 未结 8 937
醉话见心
醉话见心 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 01:56

    A different way of doing it, creating a smaller image, is to run librarian-puppet in the host, not in Docker, so you don't end with librarian, ruby, gems,... installed in the image.

    I ended with a 622MB image for jenkins slave using Puppet, and a 480MB image without Puppet.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题