简体   繁体   中英

Access host machine scanners from docker container

I am running Alfresco using docker on Linux host machine.

I have to use Alfresco with docker because of other stuff. Building script is generated using maven - You can find instruction under following link in "Generate your project from the archetypes" section.

I have connected Brother DCP-J315W to my PC via USB port.

When I execute:

scanimage -L

I am getting following result:

device 'brother4:bus2;dev1' is a Brother *DCP-J315W USB scanner

Executing the same command in docker container returns error that any scanner was found.

I tried to run containers with host network mode but it's seems senseless because it's not a network scanner.

Is there any way to use host scanners in docker containers?

Even if the Docker container could see the scanner, you'd still need software that would read scanned documents from the scanner and place them in the repository. Instead of solving the Docker-has-no-access-to-host-hardware problem, perhaps a better approach is simply to map a drive to Alfresco via WebDAV. This uses HTTP/S so you should have no problem connecting.

With that in place you should be able to run your scanning software on the host and tell it to store scanned images in the mounted drive.

An alternative approach is to check to see if your scanning software supports CMIS, which is an industry standard for working with content repositories like Alfresco. If it does, you can point your scanning software to the Alfresco CMIS service URL. That approach could potentially be better than the mounted drive method because if you are assigning metadata to your scanned documents that metadata can be written to the objects in Alfresco via CMIS, whereas a straight file mount would just write the files into the repo without additional metadata.

In Addition to Jeff Potts answer:

Only very few scanner software solutions support to transfer using http/webdav/cmis. I wouldn't recommend to directly scan into Alfresco at all. Most scanner software solutions expect to write/change/delete several files before finishing the final image/pdf in a fileshare or local filesystem. Writing directly into Alfresco may cause at least a lot of unwanted binary content kept for weeks before cleaned up in the repository or in worst case wouldn't work at all.

Instead, I suggest you connect your scanner to any OS, write the files to a temporary local folder and a simple cron script could upload the scanned files older than a minute into an Alfresco Folder. This would also allow to eg pipe the docs thru an OCR process to allow documents to be searched inside Alfresco.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM