Revise not triggering in Docker container with mounted volume

I have a docker container based off julia:latest. The container is configured to run Julia apps and I mount the local app folder into the container. So Julia runs within the container while the files are edited on the host and the updates are visible in the container.

Revise however does not trigger. Is it a known issue or am I missing something? If it’s a known issue, what’s the recommended workflow to develop Julia apps in Docker containers? Thanks!

This is how I start the container:

$ docker run -it --rm -p 8000:8000 --name geniedev -v /Users/adrian/Projects/testapp:/app genie bin/repl

or

docker run -it --rm -p 8000:8000 --name geniedev --mount 'type=bind,src=/Users/adrian/Projects/testapp,dst=/app' genie bin/repl

with the same effect.

A final attempt to resurface this, in case anybody tried using Julia in Docker with Revise.

I am not sure whether bind mounts supports inotify, check that and see

https://timholy.github.io/Revise.jl/stable/#If-Revise-doesn’t-work-as-expected-1

https://timholy.github.io/Revise.jl/stable/config/#Polling-and-NFS-mounted-code-directories:-JULIA_REVISE_POLL-1

2 Likes

Thanks for the tips - I’ll try it with pooling, hopefully it will be good enough.

Are you creating the appropriate Julia config file in your docker image + setting the accompanying environment variable for Revise? I develop with Julia + Revise extensively from within docker containers and some snippets from my dockerfile that enable this are:

RUN mkdir ~/.julia/config && \
    printf "atreplinit() do repl\ntry\n@eval using Revise\n@async Revise.wait_steal_repl_backend()\ncatch\nend\nend\n" >> ~/.julia/config/startup.jl 

RUN printf "using OhMyREPL; using BenchmarkTools; enable_autocomplete_brackets(false); cd(\"/projectname.jl\"); using Pkg; Pkg.activate(\".\")" >> ~/.julia/config/startup.jl

I also have an init_julia.jl script that I call when building my docker image that installs Revise, auxiliary dev packages, mounts the project I’m working on to /projectname.jl, and then I overwrite /projectname.jl with my volume mounts (all of this encoded in a docker-compose.yml file so I don’t have to remember how to configure everything from the command line)

1 Like

Thanks @curtd! No, I don’t have such a setup - I basically just tried to port my local setup (macOS) over to Docker, which amounts to installing dependencies and having ENV["JULIA_REVISE"] = "auto".

That’s pretty awesome, I’ll give it a try. Docker dev is an important feature and I’d be happy to not have to resort to pooling.

Good luck! I think those lines in your DockerFile should be sufficient to get you up + running with Revise, but if not, let me know. I’ve been meaning to write up a blog post about Docker + Julia development, but, alas, who has the time?

Thank you :slight_smile:

1 Like