[PYTHON] I created an Anaconda environment using Docker!

Purpose

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.

Operating environment

Mac: Catalina version 10.15.5 Docker: 19.03.8

Installation method

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

References

Dare to set environment variables with the source command in Dockerfile Work to add an environment where jupyter notebook works with docker

Recommended Posts

I created an Anaconda environment using Docker!
Created an environment for Anaconda & Jupyter
Build an Anaconda virtual environment
Build a go environment using Docker
Python3.6 environment construction (using Win environment Anaconda)
I created an environment for Masonite, a Python web framework similar to Laravel, with Docker!
Build and try an OpenCV & Python environment in minutes using Docker
Building an HPC learning environment using Docker Compose (C, Python, Fortran)
[Python] Building an environment with Anaconda [Mac]
I created an SFTP-only user on Linux.
How to create an NVIDIA Docker environment
CSS environment created in 10 minutes using Django
Created Ubuntu, Python, OpenCV environment on Docker
Creating a virtual environment in an Anaconda environment
I compared using Dash and Streamlit in Docker environment using B league data
For beginners to build an Anaconda environment. (Memo)
Build Python3.5 + matplotlib environment on Ubuntu 12 using Anaconda
Building an Anaconda environment for Python with pyenv
I created a Dockerfile for Django's development environment
I started Docker
I tried to create an environment to check regularly using Selenium with AWS Fargate
Build an OpenCV4 environment on Raspberry Pi using Poetry
Create an Anaconda virtual environment in your project folder
I tried to get an AMI using AWS Lambda
I tried to become an Ann Man using OpenCV
[Go + Gin] I tried to build a Docker environment
Building an environment for displaying organic compounds using RDKit
Command line collection for using virtual environment in Anaconda
I got an error when using Tensorboard with Pytorch
Build a lightweight Fast API development environment using Docker
I tried using parameterized
I tried using argparse
I built an environment for machine learning from scratch (windows10 + Anaconda + VSCode + Tensorflow + GPU version)
I tried using mimesis
I tried using anytree
Environment construction: GCP + Docker
I tried using aiomysql
I tried using Summpy
I tried using coturn
I tried using Pipenv
I tried using matplotlib
I tried using "Anvil".
I tried using Hubot
I tried using ESPCN
I can't install Anaconda!
I tried using openpyxl
I tried using Ipython
I tried using PyCaret
I tried using cron
I tried using ngrok
I tried using face_recognition
I tried using Jupyter
I made an Ansible-installer
I tried using PyCaret
Anaconda3 environment installation procedure
I tried using Heapq
Anaconda environment construction memo
I tried using doctest
Docker under proxy environment
I tried using folium
I tried using jinja2