从docker容器内打印

Chr*_*ish 8 cups docker

随着GUI应用程序的涌入移植到docker,从docker容器内打印到杯子的最佳方法是什么?

注意:我不打算从容器内部运行杯子,因为这打破了与docker相关的单一服务范例.

Chr*_*ish 8

自我记录调查工作后如何实现这一目标.

使用基于Ubuntu的docker主机安装在杯子插槽中工作得很好... ish(acroread无法填充打印机),但是使用Redhat主机失败了.

...
-v /var/run/cups:/var/run/cups:ro
...
Run Code Online (Sandbox Code Playgroud)

填充杯子client.conf似乎是一个更好的解决方案.

cat /tmp/client.conf

#The ServerName directive specifies sets the remote server 
# that is to be used for all client operations. That is, it 
# redirects all client requests to the remote server. The 
# default port number is 631 but can be overridden by adding
# a colon followed by the desired port number to the value.
# The default is to use the local server ("localhost").
ServerName <DOCKER0 BRIDGE IP>
Run Code Online (Sandbox Code Playgroud)

和docker启动参数:

...
-v /tmp/client.conf:/etc/cups/client.conf:ro \
...
Run Code Online (Sandbox Code Playgroud)

我还必须确保cups服务器绑定到docker0网桥并允许其他设备访问cups服务器:

...
Listen *:631
...
<Location />
  Order allow,deny
  Allow all
</Location>
...
Run Code Online (Sandbox Code Playgroud)

一旦杯子重新启动并且杯子client.conf传递到容器中,我就能按预期打印.