I am trying to find a way to create a Docker image having python as well as fritzconnection ( fritzconnection documentation — fritzconnection 1.10 documentation) installed in a slim OS (like debian:bullseye-slim or alpine:latest) to have a Docker Container for easily monitoring the FritzBox data within a database (like InfluxDB)
My first attempts did not work so far.
FROM debian:bullseye-slim
#User information, e.g. root
ARG RUN_UID=0
ARG RUN_GID=0
#Required packages: python and fritzconnection
RUN apt-get -q update && apt-get -q install python3-pip gcc bash -y
RUN pip3 install fritzconnection
#Create logfile directory
ADD configs/ /etc/fritzconnection/configs
#Port to be used
EXPOSE 25826
CMD start
The database (e.g. InfluxDB) should be setup in a separate container. In best case the connection for FritzBox Login data as well as InfluxDB access can be stored in a *.cfg file or similar.
Maybe you can help? Is there a good way to share the current draft code to be adapted (e.g. should I create a Docker Hub Repository)?
Your image just builds fine. But I doubt your CMD actually does what you think it does… How is start related to fritzconnection, and how does it actualy start it?
You didn’t start any container just built the image. You have to start a container from it. What happens when you start it? Did you expect to start a container because of the last line?
To be honest, I think here my knowledge gap finds its beginning after completion of the setup and installation of the image,
would a e.g. python script be the „only thing required“ to start the logic within the container via start command?
Where to put this logic as best practice?
How do I decide if a whole system image (e.g. alpine or buster) is necessary or if I also could just chose the python base image for my intention?
My goal is to have a python3 container that can be configured to easily setup the fritz-connection module, the connection information of the FritzBox and the influx DB connection to write the data to a defined database. (for monitoring the FritzBox and such information like data traffic as it was done by FritzCollectd running on python 2.7)
Sometimes questions are the better answers with your questions, I have found out my issue: Thought Knots…to sum up: the container building is correct but no program logic is triggered. So I need to write some python code doing the program flow “fill the Influx database with information grabbed from the Fritzbox” which needs to be triggered within the start CMD.