Docker Community Forums

Share and learn in the Docker community.

Fix python path in DockerImage


#1

I have the following dockerfile:

FROM ubuntu:16.04

RUN export DEBIAN_FRONTEND=noninteractive && \
    apt-get update && \
    apt-get upgrade -y --allow-unauthenticated && \
    apt-get install -y --allow-unauthenticated \
        build-essential \
        cmake \
        curl \
        gdal-bin \
        git \
        gsfonts \
        libfreetype6-dev \
        libgdal-dev \
        libgdal-dev \
        libpng12-dev \
        libssl-dev \
        libxpm-dev \
        libzmq3-dev \
        module-init-tools \
        openjdk-8-jdk \
        openjdk-8-jre-headless \
        pkg-config \
        proj-bin \
        proj-data \
        python \
        python3 \
        python3-dev \
        python3-netcdf4 \
        python3-pip \
        python3-requests \
        python3-simplejson \
        python-dev \
        python-netcdf4 \
        python-pip \
        python-requests \
        python-simplejson \
        r-base \
        r-base-dev \
        rsync \
        software-properties-common \
        unzip \
        vim \
        wget \
        zip \
        zlib1g-dev \
        && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN wget -nv -O ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
    bash ~/miniconda.sh -b -f -p /opt/conda && \
    export PATH=/opt/conda/bin:$PATH && \
    conda install --yes anaconda && \

Although I am setting python path to Miniconda3 but when I do python, it picks up python 2 rather than python 3. Is there something I am doing wrong ?

Thanks for your help