Compose: docker compose build is slow with existing volumes

Created on 27 Feb 2018  路  3Comments  路  Source: docker/compose

Hello!
I have a nextcloud installation, and I notice that once the size of your volumes gets big (20GB) updating the container images using
docker-compose build --pull
becomes very slow (tens of minutes) on linux. Is that normal behaviour?
My volumes are mapped to host directories.

I can fix the issue by temporarily moving the volumes folders before running the command, but ideally, I wouldn't have to do that.

Cheers!

arebuild kinquestion

Most helpful comment

Your mounts are probably part of your build context (typically your application folder). When you trigger a build, Compose makes a tar archive of your build context and sends it to the engine. That can take a while if you have a lot of data to archive.

The solution is to either mount these folders outside of your build context, or add them to your .dockerignore.

HTH!

All 3 comments

Your mounts are probably part of your build context (typically your application folder). When you trigger a build, Compose makes a tar archive of your build context and sends it to the engine. That can take a while if you have a lot of data to archive.

The solution is to either mount these folders outside of your build context, or add them to your .dockerignore.

HTH!

Yes, that was the issue, I moved out the volumes and now it works great!
Thanks for your help.

hello , can you help me how to move out the volumes , i mean the way that you done please ?

Was this page helpful?
0 / 5 - 0 ratings