Rust compiler in jupyter lab docker instance

Viewed 50

I am trying to install the rust compiler within a jupyter docker image. Here in the following the dockerfile:

FROM jupyter/scipy-notebook:python-3.10.5 as base

RUN pip install nb_black

USER root
RUN apt update && apt upgrade
RUN apt install build-essential -y
RUN apt install curl -y

USER jovyan

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

RUN pip install maturin

COPY ./docker_helpers /rust_inst
RUN chmod a+x /rust_inst/setup_rust.sh
RUN /rust_inst/setup_rust.sh

FROM base as prod

CMD ["jupyter", "lab", "--ip", "0.0.0.0"]

and the setup_rust.sh contains just an export statement:

#!/bin/bash

export PATH="$HOME/.cargo/bin:$PATH"

I need to use the root user initially for some permission denied, but after that the jovyan user is able to install all the necessary, or at least I do not get any error from docker at building time.

Does the jupyter docker structure mask the path variable, or make unavailable anything outside jovyan? How can I have the rust compiler available from a terminal within jupyter?

1 Answers

I realised that the home directory is set to "/home/jovyan" itself, which in docker compose I overwrote with a volume in order to have dynamical code. Once I moved the volume I found the rust compiler in the scope of the jovyan user

Related