Elixir slow in devcontainer (vscode and docker)

Just wanted to share my experience:

I was suffering with my elixir vscode devcontainer (docker) environment, because tests took ~20 seconds to start running.

I tried delegating the workspace:
- ..:/workspace:delegated
This makes the shared folder (between the container and the host) to write first on the container and to be eventually consistent with the host, so it doesn’t try to sync all the time.

At the beginning it worked, but sometime at the beginning of this year (2021) slowed down again.

Finally got with this amazing post by Marcus Baguley, that recommends to change the /deps and /_build folder to somewhere outside the workspace folder:


And now it works as expected.
Totally recommended for your dev environment!


That’s cool. Thanks for sharing


Another benefit besides speed from moving your build deps out of your volume mount path is that you will no longer have a bunch of dependencies volume mounted back to your dev box, so things stay tidy.

My Phoenix + Docker example starter project has this set up here: GitHub - nickjj/docker-phoenix-example: A production ready example Phoenix app that's using Docker and Docker Compose.

It’s also a discussion point in my upcoming DockerCon talk because this concept applies to other things too like node_modules/ (which is also customized in the above repo btw).


Did you try .dockerignore file where you can put folders to ignore and Docker will not use them for loading?

Are you on a MAC?