VScode _and_ julia inside docker - Dockerfile?

Is anyhone running VScode and Julia inside a single docker container?

Is there an example of a Dockerfile I could use a guide for how to do this?

thank you for any replies.

Are you familiar with the remote support for docker in VS Code? I would pursue that.

1 Like

Yes, which makes me think it is possible. I guess no one has tried it yet (including julia in the docker as well).

I will try it.

I don’t think you want to run VS Code (the UI part) in docker, though, right?

The setup where you run VS Code and connect to a docker container via the remote stuff, and then have the Julia extension and Julia itself run in the docker image works perfectly.

That’s right - I believe the UI part will be outside docker, connecting to a VScode server inside docker, as well as julia inside docker.

I develop like that: it helps to keep my side-projects from interfering with my work development environment.

I think you can just use the julia image so in devcontainer.json use image: "julia:<version>". But I’ve also attached my Dockerfile that runs a jupyter server and some other toin case it’s useful.

FROM julia:1.5

# Create necessary user
RUN useradd -m jupyter
RUN mkdir /home/jupyter/project
WORKDIR /home/jupyter/project

# Install git
RUN apt update && apt install -y git

# Install IJulia and jupyterlab via conda
RUN julia -e "using Pkg; Pkg.add(\"IJulia\"); using IJulia"
RUN julia -e "using Pkg; Pkg.add(\"Conda\"); using Conda; Conda.add(\"jupyterlab\"); Pkg.rm(\"Conda\")"

# Configure jupyterlab server
EXPOSE 8888
RUN mkdir /root/.jupyter
COPY ./.devcontainer/jupyter_notebook_config.py /root/.jupyter/jupyter_notebook_config.py

# Add Tini. Tini operates as a process subreaper for jupyter. This prevents kernel crashes.
ENV TINI_VERSION v0.6.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /usr/bin/tini
RUN chmod +x /usr/bin/tini

COPY ./Manifest.toml .
COPY ./Project.toml .
RUN julia -e "using Pkg; Pkg.activate(\".\"); Pkg.instantiate(); Pkg.precompile()"


ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["/root/.julia/conda/3/bin/jupyter-lab", "--no-browser", "--ip=0.0.0.0", "--allow-root"]

Full disclosure, I’m not sure tini is running correctly, or even necessary. I’m sorry I can’t remember where I found that suggestion.

1 Like