Docker Community Forums

Share and learn in the Docker community.

How to share my printer from host to docker image?

(Binhualiu1983) #1

I deployed my GUI app on docker image, How to share my printer from host to docker image? Thanks very much

(Andy Rothfusz) #2

I haven’t tried this myself, so I don’t have detailed instructions to offer. But I think I can point you in the right direction.

First you’ll need to learn how your host system talks with the printer. This may just be /dev/lp or you might have a more complicated printer queue service running. I’ll assume you have /dev/lp (if you have a service, then just connect to that from the container over TCP).

You can bind mount a host device into a container with --device (See Command Line Run ) You might need to add some privileges to the container to allow it to communicate with the device. A very broad privilege to grant is just to add --privileged, but it would be better (more secure) to only give the permissions actually needed. I don’t know what those are off hand, but you would add them with --cap-add when you docker run.

I hope that helps and I hope other people can add either specifics on what privileges to add or show you a better way.

(Binhualiu1983) #3

Andy, nice guide! I will try some my research on this direction. THanks very much