# VScode \_and\_ julia inside docker - Dockerfile?

**URL:** <https://discourse.julialang.org/t/vscode-and-julia-inside-docker-dockerfile/38630>\
**Category:** VS Code\
**Created:** [May 2, 2020, 10:47pm UTC](https://discourse.julialang.org/t/vscode-and-julia-inside-docker-dockerfile/38630 "2020-05-02T22:47:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaynick](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jaynick](https://discourse.julialang.org/u/jaynick)\
**Post date:** [May 2, 2020, 10:47pm UTC](https://discourse.julialang.org/t/vscode-and-julia-inside-docker-dockerfile/38630/1 "2020-05-02T22:47:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [May 3, 2020, 9:12am UTC](https://discourse.julialang.org/t/vscode-and-julia-inside-docker-dockerfile/38630/2 "2020-05-03T09:12:07Z")

</div>

Are you familiar with the [remote support for docker](https://code.visualstudio.com/docs/remote/containers) in VS Code? I would pursue that.

---

<div class="post-metadata">

**Author:** ![jaynick](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jaynick](https://discourse.julialang.org/u/jaynick)\
**Post date:** [May 6, 2020, 5:39pm UTC](https://discourse.julialang.org/t/vscode-and-julia-inside-docker-dockerfile/38630/3 "2020-05-06T17:39:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [May 6, 2020, 7:19pm UTC](https://discourse.julialang.org/t/vscode-and-julia-inside-docker-dockerfile/38630/4 "2020-05-06T19:19:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jaynick](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jaynick](https://discourse.julialang.org/u/jaynick)\
**Post date:** [May 9, 2020, 2:56am UTC](https://discourse.julialang.org/t/vscode-and-julia-inside-docker-dockerfile/38630/5 "2020-05-09T02:56:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jjminton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jjminton/32/21948_2.png) [@jjminton](https://discourse.julialang.org/u/jjminton)\
**Post date:** [February 13, 2021, 10:59am UTC](https://discourse.julialang.org/t/vscode-and-julia-inside-docker-dockerfile/38630/6 "2021-02-13T10:59:54Z")

</div>

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.

```julia
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.
