I'm working on a password manager project, and I developed on Fedora 40 in a pretty quick way, now I'm trying to make a .exe file to deploy my project on Windows, so I built the .exe file with PyInstaller and I started to write a Dockerfile:
FROM python:3.10-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN pip install tk
RUN /usr/bin/dnf install tk-devel #This one
COPY . .
CMD ["python", "PMUID.py"]
firstly, I tried to run this file without the sixth line, I typed docker build -t pmuid-app .
on bash, the build process was executed succesfully, but then when I tried to run docker run -it --rm pmuid-app
and I get this error:
stroop@fedora-d:~/PMUID$ docker run -it --rm pmuid-app
Traceback (most recent call last):
File "/app/PMUID.py", line 4, in <module>
import tkinter as tk
File "/usr/local/lib/python3.10/tkinter/__init__.py", line 37, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: libtk8.6.so: cannot open shared object file: No such file or directory
And yeah, I have installed tk inside my .venv python env, honestly, I'm actually upset about this errors from every .exe that I've made, Although I tried a lot of possible solutions, this bug wasn't fixed, anyways, I added new line into Dockerfile, and bash show me this:
stroop@fedora-d:~/PMUID$ docker build -t pmuid-app .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
Install the buildx component to build images with BuildKit:
https://docs.docker.com/go/buildx/
Sending build context to Docker daemon 434.9MB
Step 1/8 : FROM python:3.10-slim
---> 5f42e6b8b17e
Step 2/8 : WORKDIR /app
---> Using cache
---> d8334c6d0fe9
Step 3/8 : COPY requirements.txt .
---> Using cache
---> 727d1fc33b7f
Step 4/8 : RUN pip install -r requirements.txt
---> Using cache
---> fed50ddeedcd
Step 5/8 : RUN pip install tk
---> Using cache
---> 3dd74195c49d
Step 6/8 : RUN /usr/bin/dnf install tk-devel
---> Running in f3d680db3777
/bin/sh: 1: /usr/bin/dnf: not found
The command '/bin/sh -c /usr/bin/dnf install tk-devel' returned a non-zero code: 127
My main goal is just make this app reachable to both Linux and Windows, I need to run the .exe succesfully throuh Docker.
python
images are based on Debian GNU/Linux and use APT as their primary packaging tool, notdnf
; also see packages.debian.org for a list of available packages, including a way to search packages by filename.