简体   繁体   中英

Exposing Docker application to host

I wish to run a legacy application which is compatible with centos6 which no longer has some dependencies maintained and therefore is incompatible with centos7. This application is called pdftk.

I want to (if this is remotely possible) run pdftk within a docker image of centos6 and expose this application to centos7...

The app does a couple of things:

Takes a PDF document as input & form data as input -> fills the PDF with the form data -> outputs the filled in PDF.

The command might look a little like this:

pdftk input.pdf --do-something output.pdf

Would something like this be possible with docker?

So far I have been able to initialise a centos6 image and successfully install pdftk. Any help with the next part (again if possible) would be most appreciated.

Thanks

You can write a Dockerfile with Centos6 as base, then install pdftk and any other dependency. Finally use Dockerfile command ENTRYPOINT to set the pdftk as the command of your image, and pass it the arguments you wish. For example (I haven't tested it, it's only an example):

FROM centos:centos6
RUN yum install pdftk
ENTRYPOINT ["/usr/bin/pdftk"]

Then you can build this image. Supposed you call it 'pdftk', you could run the container as: docker run -it --rm pdftk <arguments> -> docker run -it --rm -v ~/my_pdfs:/pdfs pdftk /pdfs/input.pdf --do-something /pdfs/output.pdf

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