Here's how you can use Docker to keep several version of KiCad on your system and have them run as if they were native.
I'd like KiCad to appear as if it was natively installed so I change the desfault user from KiCad to my local username, and give that user sudo rights.
FROM kicad/kicad:9.0
ENV DEBIAN_FRONTEND=noninteractive
# Create a non-root user
ARG ORIGINALUSER=kicad
ARG USERNAME=simon
ARG UID=1000
ARG GID=1000
USER root
RUN usermod -l $USERNAME -d /home/$USERNAME -m -s /bin/bash $ORIGINALUSER \
&& groupmod -n $USERNAME $ORIGINALUSER \
&& apt-get update && apt-get install -y sudo \
&& echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Set environment variables for the new user
ENV HOME=/home/${USERNAME}
WORKDIR /home/${USERNAME}
USER ${USERNAME}
CMD ["bash"]
docker build -f kicad.Dockerfile --build-arg UID=$(id -u) \
--build-arg GID=$(id -g) --build-arg USERNAME=$(whoami) -t kicad9 .docker run -it --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v ${HOME}:${HOME} \
--name kicad9 \
kicad9I have a shell script in my local path called kicad9 (and kicad8)
#!/bin/sh
docker run --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME:$HOME \
--device /dev/dri \
--group-add video \
kicad9 "$@"Add -it if you want an interactive terminal.
--device /dev/dri
--group-add videoThis allows GPU rendering if available so you're not stuck with software only
You can do the same with KiCad 7 and 8 also, just change the base image.