I've been trying to get a docker file running for three days now, but keep failing to install pandas.
Here you can see my Dockerfile
# Dockerfile
# Use an official Python runtime as a parent image
FROM python:3.8-slim-buster
# Set the working directory to /app
# in the container
WORKDIR /app
# Install any needed packages specified in requirements.txt
COPY requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt
# Copy the python script
COPY modbus_to_influx.py /app/modbus_to_influx.py
# Run app.py when the container launches
# The -u flag specifies to use the unbuffered output.
# in this way, what's printed by the app is visible on the host
# while the container is running
CMD ["python3", "-u", "modbus_to_influx.py"]
And here the requirements.txt
influxdb
minimalmodbus
numpy
pandas
What am I doing wrong here?
I have the solution
I've used now not the python container, instead, I've used the Debian container and installed there all dependencies. This works fine now
# Dockerfile
# Use an official Python runtime as a parent image
FROM debian:10.3-slim
# Set the working directory to /app
# in the container
WORKDIR /app
# Install any needed packages specified in requirements.txt
RUN apt-get update && apt-get -y dist-upgrade
RUN apt-get -y install apt-utils \
build-essential \
python3 \
gcc \
python3-dev \
python3-pip \
python3-numpy \
python3-pandas
COPY requirements.txt /app/requirements.txt
RUN pip3 install -r requirements.txt
# Copy the python script
COPY modbus_to_influx.py /app/modbus_to_influx.py
# Run app.py when the container launches
# The -u flag specifies to use the unbuffered ouput.
# in this way, what's printed by the app is visible on the host
# while the container is running
CMD ["python3", "-u", "modbus_to_influx.py"]