Help on how to implement hot reload of file changes in a docker stack

Hello guys,

I’m sorry to ask this question again but I’m new to elixir lang and I wanted to know how to have a reload of the compiler when mix files changes.
I’ve added the inotify-tool to my phoenix container but it still does not the work…
I browsed some similar issues but i still don’t quite understand.

Sorry again for the inconvenience.
Thank you very much for your attention.

When you change the mix.exs you have to manually restart your application, even without docker.

1 Like

Thank you for your answer but this is the case for all .ex files ?

No. Phoenix autoreloader does trigger reload only for changes made to files within web, and even there not all. Note sure though which trigger the reload.

In general it’s a feature I rarely rely on. Only for tinkering the view and templates it’s a nice thing.

For everything else I prefer to explicitly restart the application, just to be sure. Especially as I’m developing most in a TDD/BDD like manor.

Especially with docker in place, file watching can become a major problem.

Why don’t you develop locally without docker? Docker containers are not a Dev VM.


Reloading the project after mix.exs is changed makes sense – there might be new (or removed) dependencies and the project is assumed to need full recompilation. It can probably be done better but eh, not such a big deal either.

As for all .ex files – it only works in dev environment (or when you explicitly opt-in for monitoring files for changes). In production by default this doesn’t work (happily).


Yeah I understand, this makes a lot of sense, I don’t understand how my thoughts led me to this question.

@NobbZ I know, but for my dev process as i’m working with teammates on this project I wanted to ease their way in. We will now only work locally and then run docker to see if some errors will be thrown.
Thank you for your time mate !

@dimitarvp The explaination given by NobbZ were explicit enough but yours bring more details and I thank you for that.

Sorry for wasting your time guys.

Have a great day !