I get the error
_tkinter.TclError: couldn't connect to display ":0.0"
when I try to run my container. The following is my dockerfile.
#syntax=docker/dockerfile:1
FROM python:3.8
RUN pip install --upgrade pip
RUN useradd myuser
USER myuser
WORKDIR /home/myuser
COPY requirements.txt requirements.txt
ENV DISPLAY=:0.0
RUN pip install tk && \
pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "./python/ImageViewer.py"]
I have looked at other solutions and have set my DISPLAY variable to :1, :0, :$DISPLAY, and many more. I keep getting this error, I think it is because it is docker. I have also tried other solutions involving pip install other libraries and such. If anyone knows how to set the enviornment variable for DISPLAY for tkinter I would appreciate any tips. Thank you.