简体   繁体   English

wsl 上的 Docker-compose 无法在容器中启动终结器

[英]Docker-compose on wsl cannot start terminator in container

Good day to everyone,祝大家有美好的一天,

I seem to have a problem with docker-compose and wsl2 on windows 10. I am running docker on ubuntu 20.04 in wsl2 on windows 10. For some reason if I run the docker image with this command:我似乎在 windows 10 上遇到了 docker-compose 和 wsl2 的问题。我在 windows 10 上的 wsl2 中的 ubuntu 20.04 上运行 docker。由于某种原因,如果我使用以下命令运行 docker 映像:

sudo docker run --rm -it --network host -e DISPLAY -v ${HOME}/.config/terminator:/home/user1/.config/terminator -v /tmp/.X11-unix:/tmp/.X11-unix -v ${PWD}/.bashrc_local:/home/user1/.bashrc_local -e QT_X11_NO_MITSHM=1 --privileged hsp/ros2-bench-test:r1Sim2

Bash runs as expected and I can start terminator and other GUI based software. Bash 按预期运行,我可以启动终结器和其他基于 GUI 的软件。

But if I use docker-compose I get this error:但是,如果我使用 docker-compose 我会收到此错误:

sudo docker-compose up
Creating network "docker_compose_default" with the default driver
Creating terminator                       ... done
Creating docker_compose_yarp-ros2-image_1 ... done
Attaching to terminator, docker_compose_yarp-ros2-image_1
terminator         | 
terminator         | (terminator:20724): dbind-WARNING **: 07:58:24.948: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
terminator         | Unable to connect to DBUS Server, proceeding as standalone
terminator         | 
terminator         | ** (terminator:20724): WARNING **: 07:58:25.089: Binding '<Control><Alt>a' failed!
terminator         | Unable to bind hide_window key, another instance/window has it.
terminator         | Traceback (most recent call last):
terminator         |   File "/usr/bin/terminator", line 133, in <module>
terminator         |     TERMINATOR.layout_done()
terminator         |   File "/usr/lib/python3/dist-packages/terminatorlib/terminator.py", line 329, in layout_done
terminator         |     terminal.spawn_child()
terminator         |   File "/usr/lib/python3/dist-packages/terminatorlib/terminal.py", line 1500, in spawn_child
terminator         |     result,  self.pid = self.vte.spawn_sync(Vte.PtyFlags.DEFAULT,
terminator         | gi.repository.GLib.GError: g-io-error-quark: Failed to execute child process “/bin/bash”: Failed to fdwalk: Operation not permitted (14)
terminator exited with code 1
docker_compose_yarp-ros2-image_1 exited with code 0

The docker-compose is the following: docker-compose 如下:

version: "3.7"

x-base: &base
  image: hsp/ros2-bench-test:r1Sim2
  environment:
    - DISPLAY=${DISPLAY}
    - XAUTHORITY=/home/user1/.Xauthority
    - QT_X11_NO_MITSHM=1
    - LIBGL_ALWAYS_INDIRECT=0
    - YARP_COLORED_OUTPUT=1
  volumes:
    - "/tmp/.X11-unix:/tmp/.X11-unix:rw"
    - "/etc/hosts:/etc/hosts"
    - "/home/elandini/.gitconfig:/home/user1/.gitconfig"
    - ".bashrc_local:/home/user1/.bashrc_local"
    - "/home/elandini/.config/terminator:/home/user1/.config/terminator"
  network_mode: host
  ipc: host
  pid: host
  security_opt:
    - apparmor:unconfined


services:

# Images
  yarp-ros2-image:
    image: hsp/ros2-bench-test:r1Sim2
    build:
      dockerfile: Dockerfile
      target: ros2CtrlDefault
      context: .


  terminator:
    <<: *base
    container_name: terminator
    command: terminator -g /home/user1/.config/terminator/config

I cannot see the error in the docker-compose.yaml file, but I am quite new to docker-compose and so it may be really trivial.我在 docker-compose.yaml 文件中看不到错误,但我对 docker-compose 还是很陌生,所以它可能真的很微不足道。

EDIT编辑

Thanks to ste93 for the answer .感谢ste93回答 With privileged: true everything works. privileged: true一切正常。

Does anybody knows a way to avoid giving privileges to the container and still make this work?有没有人知道一种方法可以避免授予容器特权并且仍然可以进行这项工作?

如果您将privileged: true放在 docker compose 中,它应该可以工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 docker-compose 错误无法启动服务 mongo:驱动程序在端点上编程外部连接失败 - docker-compose Error Cannot start service mongo: driver failed programming external connectivity on endpoint 来自 docker-compose 的 Docker 容器无法再连接到主机 - Docker containers from docker-compose cannot connect to host anymore Windows上的“ docker-compose up”失败,并出现Mysql容器步骤错误 - “docker-compose up ” on Windows failed with error on Mysql container step Windows上的docker-compose - 找不到容器命令&#39;sh&#39;或不存在 - docker-compose on Windows - Container command 'sh' not found or does not exist 来自 docker-compose 的环境变量没有传递给容器 - Environment variable from docker-compose not being passed to container 周末后无法在docker-compose中将文件挂载为卷,为什么? - Cannot mount file as a volume in docker-compose after weekends, why? 使用docker-compose build时Docker不创建新容器 - Docker does not create a new container when using docker-compose build 我想在 ZAEA23489CE3AA9B6304EBB28E0CD 上使用 docker-compose 将 windows 驱动器安装到 windows 容器中 - I want to mount a windows drive into a windows container using docker-compose on Windows 是否有可能从本地网络内的另一台机器访问 docker-compose 容器? - Is there a possibility to access a docker-compose container from another machine inside the local network? 错误 - Docker-compose/docker Windows - ERROR - Docker-compose/docker Windows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM