How do you add items to .dockerignore?

前端 未结 8 994
醉话见心
醉话见心 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条回答
  •  -上瘾入骨i
    2020-12-29 01:48

    .dockerignore is to prevent files from being added to the initial build context that is sent to the docker daemon when you do docker build, it doesn't create a global rule for excluding files from being created in all images generated by a Dockerfile.

    It's important to note that each RUN statement will generate a new image, with the parent of that image being the image generated by the Dockerfile statement above it. Try collapsing your RUN statements into a single one to reduce image size:

    RUN librarian-puppet install &&\
     puppet apply --modulepath=/modules -e "class { 'buildslave': jenkins_slave => true,}" &&\
     librarian-puppet clean
    

提交回复
热议问题