Julia docker image for AWS Sagemaker Studio won't run

Hi all,

I am trying to create a docker image for Julia that will run on AWS Sagemaker Studio, but it won’t even load an image terminal, run Julia command line, or the kernel in Studio. I have successfully created an image for R and run it on Sagemaker Studio using the instructions here Create a SageMaker image from the ECR container image - Amazon SageMaker. My docker file is edited from one given in the Jupyter docker repo:

FROM ubuntu:22.04

# Use bash rather than shell
# RUN rm /bin/sh && ln -s /bin/bash /bin/sh

ARG NB_USER="sagemaker-user"
ARG NB_UID="1000"
ARG NB_GID="100"

# Defaulting to 4
# ENV JULIA_NUM_THREADS=4
# RUN echo $JULIA_NUM_THREADS

RUN apt-get update && apt-get update
RUN apt-get -y install apt-utils

RUN apt-get -y install fonts-dejavu
RUN apt-get -y install tzdata
RUN apt-get -y install odbcinst1debian2 libodbc1 odbcinst unixodbc unixodbc-dev
RUN apt-get -y install curl libcurl4-openssl-dev libssl-dev libffi-dev libfontconfig1-dev libcairo2-dev pandoc
RUN apt-get -y install wget libxml2-dev
RUN apt-get -y install gcc g++ gfortran 


RUN apt-get -y install git
RUN apt-get -y install libopenblas-dev libnlopt-dev libpng-dev

# RUN apt-get install -y r-base r-base-dev r-cran-rodbc
RUN apt-get -y install llvm-dev libclang-dev

RUN apt-get -y install python3-dev python3-pip python3-venv

# Setup the "sagemaker-user" user with root privileges.
RUN apt-get install -y sudo && \
    useradd -m -s /bin/bash -N -u $NB_UID $NB_USER && \
    chmod g+w /etc/passwd && \
    echo "${NB_USER}    ALL=(ALL)    NOPASSWD:    ALL" >> /etc/sudoers && \
    # Prevent apt-get cache from being persisted to this layer.
    rm -rf /var/lib/apt/lists/*

USER $NB_UID

# Make the default shell bash (vs "sh") for a better Jupyter terminal UX
ENV SHELL=/bin/bash \
    NB_USER=$NB_USER \
    NB_UID=$NB_UID \
    NB_GID=$NB_GID \
    HOME=/home/$NB_USER \
    MINICONDA_VERSION=latest \
    CONDA_VERSION=4.13.0 \
    MINICONDA_MD5=7843dd7d0a2c53b0df37ca8189672992 \
    CONDA_DIR=/opt/conda \
    PATH=$CONDA_DIR/bin:${PATH}

# Heavily inspired from https://github.com/jupyter/docker-stacks/blob/master/r-notebook/Dockerfile

USER root

RUN apt-get update && \
    rm -rf /var/lib/apt/lists/* && \
    mkdir -p $CONDA_DIR && \
    chown -R $NB_USER:$NB_GID $CONDA_DIR && \
    ln -s /bin/tar /bin/gtar

USER $NB_UID


RUN pip3 install --upgrade pip
RUN pip3 install numpy scipy pandas pyodbc sklearn matrix_factorization pymc3 cryptography==3.2.0 snowflake-connector-python jupyterlab notebook voila

RUN pip install --quiet --no-cache-dir \
    'boto3' \
    'sagemaker'


RUN cd $HOME


# Installing conda in case it is required
RUN sudo wget -O conda.sh https://repo.anaconda.com/archive/Anaconda3-5.3.1-Linux-x86_64.sh
RUN sudo chmod +x conda.sh
RUN sudo bash conda.sh -b -p $HOME/conda
ENV PATH="$HOME/conda/bin:${PATH}"


# Installing Julia
RUN sudo mkdir $HOME/programs
RUN sudo wget -O $HOME/programs/julia.tar.gz "https://julialang-s3.julialang.org/bin/linux/x64/1.7/julia-1.7.3-linux-x86_64.tar.gz"
RUN sudo tar -xvzf $HOME/programs/julia.tar.gz -C $HOME/programs
RUN sudo mv $HOME/programs/julia-1.7.3 $HOME/programs/julia

RUN sudo rm $HOME/programs/julia.tar.gz

ENV PATH="$HOME/programs/julia/bin:${PATH}"
ENV PATH="$HOME/.local/bin:${PATH}"

WORKDIR $HOME
USER $NB_UID

# Start IJulia
RUN ["/bin/bash", "-c", "source $HOME/.profile"]
RUN $HOME/programs/julia/bin/julia -e "using Pkg; Pkg.add(\"IJulia\"); using IJulia; notebook(detached = true)"

I have also tried using the Jupyter Notebook on Sagemaker too using the method outlined here (Jupyter julia notebook on Amazon AWS SageMaker) but this doesn’t work either. I’m using Julia version 1.7.3. I get “unknown kernel” and it just hangs.

I have also tried installing Julia via conda but that hasn’t worked either.