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
The difference between an exposed port and a published port is that the published port is available on the host, and we can see that in both "HostConfig" and "NetworkSettings". All published ( -p or -P ) ports are exposed, but not all exposed ( EXPOSE or --expose ) ports are published.
An exposed port is a piece of metadata about the containerized application. In most cases, this shows which ports the application is listening to. Docker itself does not do anything with an exposed port. However, when we launch a container, we can use this metadata when publishing the port.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With