Installing and using Anaconda for Python 2 on Windows using Docker

I am a Python 3 user. Every now and then there is a customer that requests using Python2 code or Ipython (Jupyter) Notebook in Python 2. For this reason, I tried to use Docker to make a container for Anaconda 2 on my Windows laptop.

Here is how to do it step by step:

  1. Install Docker:

    Go to Docker’s website and install Docker for Windows, if you don’t have it.

  2. Run the following commands:

    docker pull continuumio/anaconda
    docker run -i -t continuumio/anaconda /bin/bash

    or you can run the following command to be able to open a Jupyter notebook.
    docker run -i -t -p 8888:8888 continuumio/anaconda /bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir /opt/notebooks && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser"

  3.  Find your Docker IP address:

    docker-machine ip dev

  4. Open your Jupyter Notebook in your favorite browser:

    In your address bar type:
    http://192.168.99.100:8888/
    This should work by default unless your IP is different (Look at step 3)

 

Leave a Reply