Skip to content

Instantly share code, notes, and snippets.

@jschpp
Last active February 22, 2021 22:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jschpp/888c96ddf117555508ac5b38c6890c4e to your computer and use it in GitHub Desktop.
Save jschpp/888c96ddf117555508ac5b38c6890c4e to your computer and use it in GitHub Desktop.
.Net + Powershell + Jupyter = ❤️
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster
RUN apt-get update && apt-get install python3 python3-pip -y
RUN pip3 install jupyterlab
RUN dotnet tool install -g --add-source "https://dotnet.myget.org/F/dotnet-try/api/v3/index.json" Microsoft.dotnet-interactive
ENV PATH="/root/.dotnet/tools:${PATH}"
RUN dotnet interactive jupyter install
CMD ["/usr/local/bin/jupyter", "lab", "--allow-root", "--port=8888", "--ip=0.0.0.0", "--notebook-dir=/mnt"]
EXPOSE 8888
@jschpp
Copy link
Author

jschpp commented Feb 26, 2020

run with:

docker run -p 8888:8888 -v "$(pwd):/mnt"

@alexandair
Copy link

Building an image, I got an error about missing apt-get.
mcr.microsoft.com/dotnet/core/sdk:3.1 is a Windows-based (NanoServer) image.

@jschpp
Copy link
Author

jschpp commented Feb 27, 2020

Building an image, I got an error about missing apt-get.
mcr.microsoft.com/dotnet/core/sdk:3.1 is a Windows-based (NanoServer) image.

If you want to run this on a Windows machine you either need to enable linux containers in docker or I need to create a new Dockerfile

@jschpp
Copy link
Author

jschpp commented Feb 27, 2020

I've tried setting up a windows container Dockerfile...

There are a few problems there:

  • The python installer doesn't run -> can be solved by downloading/installing python on your dev machine and then copying it into the container
  • If you use the embedded version of python pip doesn't work
  • Using anaconda seems to be an open issue ContinuumIO/anaconda-issues#1762

So all in all my recommendation would be to switch to linux containers :-)

@alexandair
Copy link

Maybe I wasn't clear. The image you have in your Dockerfile tries to build a Nano Server-based image and fails. The base image is wrong. I have built a Linux container and that works.

@jschpp
Copy link
Author

jschpp commented Feb 27, 2020

hmm... Works for me but I fixed it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment