build context for docker image very large

后端 未结 10 892

I have created a couple different directories on my host machine as I try to learn about Docker just to keep my dockerfiles organized. My Dockerfile I just ran looks like t

10条回答
  •  长情又很酷
    2020-12-12 12:49

    The Docker client sends the entire "build context" to the Docker daemon. That build context (by default) is the entire directory the Dockerfile is in (so, the entire rpms tree).

    You can setup a .dockerignore file to get Docker to ignore some files. You might want to experiment with it.

    Alternatively, you can move your rpms folder one directory level above your Dockerfile, and only symlink test.rpm into the Dockerfile's directory.


    You’ll often want to add the .git folder to the .dockerignore which was the cause of a 150MB -> 5GB difference for some users in the comments here.

提交回复
热议问题