docker

This is the docker file, dockerfile, to create a Debian-11 docker image:

FROM debian:bullseye
COPY ./repos/debian.list /etc/apt/sources.list.d
COPY ./repos/debian-security.list  /etc/apt/sources.list.d
COPY ./repos/debian-updates.list /etc/apt/sources.list.d
COPY ./repos/debian-backports.list /etc/apt/sources.list.d
RUN apt -qq update
RUN apt -y install gnupg2
COPY ./repos/fsec-addons.list /etc/apt/sources.list.d
COPY ./repos/debian-pni-hdri.list /etc/apt/sources.list.d
COPY  ./repos/fsec.asc /tmp
COPY  ./repos/debian_repo.pub.gpg /tmp
RUN apt-key add /tmp/fsec.asc
RUN apt-key add /tmp/debian_repo.pub.gpg
RUN apt -qq update
RUN export DEBIAN_FRONTEND=noninteractive && apt -y install python3 ipython3 python3-pyqt5 python3-qtpy python3-bluesky python3-ophyd python3-databroker python3-pyepics python3-tango vim-gtk3 emacs
ENV QT_X11_NO_MITSHM=1
RUN useradd  -ms /bin/bash -u 1070 -g 39 kracht
USER kracht
WORKDIR /home/kracht

Cleanup:

docker stop ctemp
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)

Create image:

docker build -t blueskyp39 .

Run as user kracht, with permissions to change host files from container:

docker run -it --name ctemp -u `id -u`:`id -g` --userns=host --security-opt no-new-privileges \
   -e USER=kracht -e TANGO_HOST=haspp99:10000 --env=DISPLAY --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
   -v /home/kracht/Misc/bluesky:/home/kracht/work:rw  blueskyp39 bash

Leave the container in running state:

Ctrl-p Ctrl-q

Attach to a running container:

docker attach ctemp

Start a stopped container

docker start ctemp

Run as root:

docker run -it --name ctemp -u root -e USER=root --env=DISPLAY --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" blueskyp39 bash