Skip to content

Instantly share code, notes, and snippets.

@rwcitek
Last active August 24, 2025 20:20
Show Gist options
  • Select an option

  • Save rwcitek/3ec39253bcc5512e7679d6aaa3ec19bf to your computer and use it in GitHub Desktop.

Select an option

Save rwcitek/3ec39253bcc5512e7679d6aaa3ec19bf to your computer and use it in GitHub Desktop.
Anaconda in Docker

Build Anaconda in Docker

Build the image

cat <<'eof' > Dockerfile
FROM ubuntu:22.04

RUN apt-get update && \
    apt-get install -y \
      curl \
      bash \
      libgl1-mesa-glx \
      libegl1-mesa \
      libxrandr2 \
      libxrandr2 \
      libxss1 \
      libxcursor1 \
      libxcomposite1 \
      libasound2 \
      libxi6 \
      libxtst6 \
      ;
RUN curl -O https://repo.anaconda.com/archive/Anaconda3-2023.09-0-Linux-x86_64.sh
RUN curl -L -s https://repo.anaconda.com/archive/ > anaconda.folder.list.txt
RUN sha256sum Anaconda3-2023.09-0-Linux-x86_64.sh > shasum.txt

# bash Anaconda3-2023.09-0-Linux-x86_64.sh

COPY Dockerfile /

# docker image build --tag rwcitek/anaconda .
# docker image tag rwcitek/anaconda anaconda
# docker run -d --rm --name foo anaconda sleep inf &
# docker container exec foo /bin/bash

eof

docker image build --tag rwcitek/anaconda .
docker image tag rwcitek/anaconda anaconda

Install Anaconda in a container

docker run --rm -d -p 127.0.0.1:8888:8888 --name foo anaconda sleep inf
docker container exec -it foo bash Anaconda3-2023.09-0-Linux-x86_64.sh

Commit the container instance to an image

docker container commit foo rwcitek/anaconda:example

Push to DockerHub

docker login
docker push rwcitek/anaconda:example

Pull from Dockerhub

docker pull rwcitek/anaconda:example

Run jupyter-lab

docker container run --rm -d -p 127.0.0.1:8888:8888 rwcitek/anaconda:example \
    /root/anaconda3/bin/jupyter-lab --allow-root --ip=0 --NotebookApp.token='' 

Copy the url http://127.0.0.1:8888 in a browser.

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