Docker 容器与主机共享剪贴板 [英] Docker container sharing clipboard with host

查看:51
本文介绍了Docker 容器与主机共享剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在谷歌上搜索了一下,但没有得到有用的结果.

I searched a bit on google but got no useful results.

我正在完成对 vim 的 dockerizing 并且出现了一个常见问题:它的容器不会与主机共享剪贴板.

I'm finishing dockerizing vim and a common problem showed up: its container just won't share the clipboard with the host.

我习惯于用 +clipboard 构建 vim,并且能够抽出文本并将其提供给主机,或者将文本复制到主机并粘贴到 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...

我想过制作 -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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆