Installing Anaconda is the easiest way to analyze data in Python. However, installing Anaconda directly in the host environment may change the PC environment. So, this time, I would like to use Docker to install Anaconda in a virtual environment and start Jupyter notebook.
Mac: Catalina version 10.15.5 Docker: 19.03.8
On Docker's Official Page, download the installer and install Docker.
Save the following Dockerfile in the folder where you want to work.
FROM ubuntu:latest
RUN apt-get update && apt-get -y upgrade && \
apt-get install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1
libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6 wget -y && \
wget -P /opt https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh && \
bash /opt/Anaconda3-2020.02-Linux-x86_64.sh -b -p /opt/anaconda3 && \
rm /opt/Anaconda3-2020.02-Linux-x86_64.sh && \
echo "export PATH=/opt/anaconda3/bin:$PATH" >> ~/.bashrc && \
. ~/.bashrc && \
conda init
Build the Docker image in the folder where you saved the Dockerfile.
docker build . -t anaconda_sample
Create a container from the built image.
docker run -p 8888:8888 -it anaconda_sample /bin/bash
Move to the directory where you want to start jupyter and start jupyter notebook.
jupyter notebook --port 8888 --ip=0.0.0.0 --allow-root
Dare to set environment variables with the source command in Dockerfile Work to add an environment where jupyter notebook works with docker
Recommended Posts