【发布时间】:2021-01-22 22:30:31
【问题描述】:
我有以下 Dockerfile
FROM debian:bullseye
RUN \
apt-get -qq update && \
apt-get -qq -y --no-install-recommends install gedit && \
apt-get -qq clean && \
rm -rf /var/lib/apt/lists/
并使用以下脚本在支持 X11 的容器中启动 bash:
XAUTH=$(mktemp -t docker-XXXXXXXX)
trap "rm $XAUTH" EXIT
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
docker run --rm --init -it \
-e DISPLAY=$DISPLAY \
-e XAUTHORITY=/tmp/xauth \
-v $XAUTH:/tmp/xauth:rw \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
-u $(id -u):$(id -g) \
[image] \
/bin/bash
在容器内我可以在后台启动gedit &。第一个进程启动,一切正常,但是,在第二次启动时 gedit 崩溃:
This probably reflects a bug in the program.
The error was 'BadAccess (attempt to access private resource denied)'.
(Details: serial 717 error_code 10 request_code 130 (MIT-SHM) minor_code 1)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the GDK_SYNCHRONIZE environment
variable to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Trace/breakpoint trap (core dumped)
对gedit & 的后续调用不受影响;只有第二次调用失败。
我已经用xeyes 尝试了上述方法,这个程序似乎不受影响。
【问题讨论】: