How to configurate properly for dockerizing a Ubuntu os and some python libraries

I’m new to Docker and I want to dockerize a Ubuntu os equipped with some deep learning python libraries. My dockerfile is like this

FROM ubuntu:latest
LABEL authors="Jayce Jiang for testing"

# Update and install necessary packages
RUN apt-get update && apt-get install -y \
    python3-pip \
    python3-dev \
    python3-distutils \
    curl \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Set the current working directory

# Install TensorFlow 1.14.0
RUN pip3 install range-coder
RUN pip3 install ./tensorflow-1.14.0-cp36-cp36m-manylinux1_x86_64.whl
RUN pip3 install ./tensorflow_compression-1.2-cp36-cp36m-manylinux1_x86_64.whl

ENTRYPOINT ["top", "-b"]

I already have the required tensorflow and tensorflow_compression wheels at the same dir as my Dockerfile. But when I ran docker build. It reported a warningWARNING: Requirement './tensorflow-1.14.0-cp36-cp36m-manylinux1_x86_64.whl' looks like a filename, but the file does not exist, as well as an error ERROR: tensorflow-1.14.0-cp36-cp36m-manylinux1_x86_64.whl is not a supported wheel on this platform.
But how is this? Isn’t my wheel built for linux?

Never use a latest version of any Docker image unless there is no specific version. If you want to use Python, I recommend using a Python base image instead of installing python from an APT repo. You don’t know which version it will install and your whl file shows which CPython it is compatible with (cp36 = CPython 3.6).

I also don’t see where you copied the files into the image. That seems to be the reason of “file does not exist”.

By the way


doesn’t make sense. The WORKDIR is for changing the directory instead of using cd in a RUN instruction. Using a dot will not change anything.

Recommended links to learn the basics and concepts:

The last link is (currently) about Docker Desktop which is Docker CE in a virtual machine whith a GUI.

1 Like