Docker容器与主机共享剪贴板 [英] Docker container sharing clipboard with host
问题描述
我在Google上进行了一些搜索,但没有得到有用的结果。
I searched a bit on google but got no useful results.
我正在完成对 vim
的docker化,出现了一个常见的问题:它的容器不会与主机共享剪贴板。
I'm finishing dockerizing vim
and a common problem showed up: its container just won't share the clipboard with the host.
我习惯用 + clipboard
,并能够拉动文本并将其提供给主机,或者在主机中复制文本并粘贴到vim中...
I am used to building vim with +clipboard
, and to being able to yank text and have it available to the host, or copying text in host and pasting in vim...
I考虑过要制作 -v
卷来共享这些数据,但是我仍然无处可做。
I thought about making -v
volumes that would share this data but I still got nowhere.
我在Ubuntu上16.10。
I'm on Ubuntu 16.10.
推荐答案
剪贴板几乎可以肯定是X的一部分,因此您需要使用以下命令授予容器访问权限:
The clipboard is almost certainly part of X, so you'll need to give the container access with:
docker run -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix your_image
这篇关于Docker容器与主机共享剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!