Git Product home page Git Product logo

docker-tikaserver's Introduction

docker-tikaserver Build Status

This repo contains the Dockerfile to create a docker image that contains the latest Ubuntu LTS running the Apache Tika 1.28.4 Server on Port 9998 using Java 17.

Out-of-the-box the container also includes dependencies for the GDAL and Tesseract OCR parsers. To balance showing functionality versus the size of the image, this file currently installs the language packs for the following languages:

  • English
  • French
  • German
  • Italian
  • Spanish.

To install more languages simply update the apt-get command to include the package containing the language you required, or include your own custom packs using an ADD command.

Usage

First you need to pull down the build from Dockerhub, which can be done by invoking:

docker pull logicalspark/docker-tikaserver

Then to run the container, execute the following command:

docker run -d -p 9998:9998 logicalspark/docker-tikaserver

Building

To build the image from scratch, simply invoke:

docker build -t 'docker-tikaserver' github.com/LogicalSpark/docker-tikaserver

You can then use the following command (using the name you allocated in the build command as part of -t option):

docker run -d -p 9998:9998 docker-tikaserver

More

For more info on Apache Tika Server, go to the Apache Tika Server documentation.

Author

Contributors

There have been a range of contributors on GitHub and via suggestions, including:

Licence

Copyright 2015-2021 David Meikle

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

docker-tikaserver's People

Contributors

arjunyel avatar caugner avatar dameikle avatar grossws avatar jerska avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-tikaserver's Issues

Move tika-server.jar to, say /tika-bin/ for Tika 2.x?

With the modularization of tika 2.x, it would be useful to allow users to drop extra jars in a /tika-bin/ directory for extra-functionality. For example, adding the tika-fetcher-http module might look like this: https://cwiki.apache.org/confluence/download/attachments/186877907/Dockerfile?version=1&modificationDate=1629216716183&api=v2

If we added the -cp /tika-bin/* stuff, though, users could extend logical spark more easily.

If there are better options, please let me know.

Thank you!

Error making request

docker run --name tikaserver -d -p 9998:9998 logicalspark/docker-tikaserver java -jar tika-server-1.19.1.jar -enableUnsecureFeatures -enableFileUrl

HI, im trying to test docker-tikaserver, but when im run this command:

curl -i -X PUT http://localhost:9998/tika -H 'Accept: text/plain' -H 'fileUrl:http://www.pdf995.com/samples/pdf.pdf'

i have this error:

INFO tika (autodetecting type) WARN tika: Text extraction failed org.apache.tika.exception.ZeroByteFileException: InputStream must have > 0 bytes at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:122) at org.apache.tika.server.resource.TikaResource.parse(TikaResource.java:402) at org.apache.tika.server.resource.TikaResource$5.write(TikaResource.java:513) at org.apache.cxf.jaxrs.provider.BinaryDataProvider.writeTo(BinaryDataProvider.java:177) at org.apache.cxf.jaxrs.utils.JAXRSUtils.writeMessageBody(JAXRSUtils.java:1391) at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:246) at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:122) at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:84) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:90) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:247) at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:79) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1317) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:205) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:531) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680) at java.lang.Thread.run(Thread.java:748) ERROR Problem with writing the data, class org.apache.tika.server.resource.TikaResource$5, ContentType: text/plain

Docker image for 1.23 is broken

When running the 1.23 image, the error Error: Invalid or corrupt jarfile /tika-server-1.23.jar is given.

Inspection shows that the curl or wget for the .jar file /tika-server-1.23.jar hit a 403:

$ docker run --rm -it --entrypoint /bin/bash  logicalspark/docker-tikaserver:1.23
root@b85e10fc3daa:/# cat /tika-server-1.23.jar
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access this resource.</p>
<hr>
<address>Apache/2.4.29 (Ubuntu) Server at apache.claz.org Port 80</address>
</body></html>

Tika-Tesseract for Windows

Hi,

This is not an issue but rather a question. I am currently using this Dockerfile and manage to have containerized Tika Server running successfully using Docker for Windows.

My question is that.. can the steps on Dockerfile be replicated using purely Windows approach?

I cannot do text extraction from images using tika-server-1.20.jar on my end, while that works using the containerized Tika Server. I have setup Tesseract correctly with data file/s on Windows, but only Tesseract works, not my Tika Server using the .jar file.

Pardon my ignorance but please enlighten me. Thank you!

gpg not found when build on Xenial 16.04.3

The Ubuntu Docker build could not find the 'gpg', which for sure I have installed and got latest update. I work around this issue by adding 'gnupg2' in Dockerfile. -- Is it the right way to solve the issue?

Warnings about missing fonts

While trying to extract text from PDF file Tika prints the following warnings.

INFO tika (application/pdf)
WARN Using fallback font 'LiberationSans' for 'TimesNewRoman'
WARN Using fallback font 'LiberationSans' for 'TimesNewRoman,Italic'
WARN Using fallback font 'LiberationSans' for 'TimesNewRoman,Bold'
WARN Using fallback font LiberationSans for base font Times-Roman
WARN Using fallback font LiberationSans for base font Times-Bold
WARN Using fallback font LiberationSans for base font Times-Italic
WARN Using fallback font LiberationSans for base font Times-BoldItalic
WARN Using fallback font LiberationSans for base font Helvetica
WARN Using fallback font LiberationSans for base font Helvetica-Bold
WARN Using fallback font LiberationSans for base font Helvetica-Oblique
WARN Using fallback font LiberationSans for base font Helvetica-BoldOblique
WARN Using fallback font LiberationSans for base font Courier
WARN Using fallback font LiberationSans for base font Courier-Bold
WARN Using fallback font LiberationSans for base font Courier-Oblique
WARN Using fallback font LiberationSans for base font Courier-BoldOblique
WARN Using fallback font LiberationSans for base font Symbol
WARN Using fallback font LiberationSans for base font ZapfDingbats
WARN Using fallback font LiberationSans for Times-Roman
WARN Using fallback font LiberationSans for Times-Italic
WARN Using fallback font LiberationSans for Helvetica

After some preliminary analyses it seems that font files are missing from that Docker image. Only DejaVuSans is installed.

# docker exec -it <container-id> bash
# find /usr/share/fonts -name "*.ttf"
/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf

Tika 2.0.0 support?

Are there plans to update this for Apache Tika 2.0.0, which appears to have been released on the same day as your most recent release - July 7?

Release 1.22 Tika server to dockerhub

I saw several vulnerabilities affecting the currently shipped version of Tika, all of them resolved in 1.22 version.

Namely:

  • [CVE-2019-10088] OOM from a crafted Zip File in Apache Tika's RecursiveParserWrapper
  • [CVE-2019-10093] Denial of Service in Apache Tika's 2003ml and 2006ml Parsers
  • [CVE-2019-10094] StackOverflow from Crafted Package/Compressed Files in Apache Tika's RecursiveParserWrapper

When do you think the docker image will be available on dockerhub?

Present latest tag pushed to docker hub appears not to work

$ docker run -p 9998:9998 logicalspark/docker-tikaserver
Unable to find image 'logicalspark/docker-tikaserver:latest' locally
latest: Pulling from logicalspark/docker-tikaserver
d54efb8db41d: Already exists 
f8b845f45a87: Already exists 
e8db7bf7c39f: Already exists 
9654c40e9079: Already exists 
6d9ef359eaaa: Already exists 
82ce92ae72f5: Pull complete 
Digest: sha256:7fce25ea66c8c73c1867b19e386f4a3955ef8340d7b5f440ea14e06219cde910
Status: Downloaded newer image for logicalspark/docker-tikaserver:latest
Error: Invalid or corrupt jarfile /tika-server-1.14.jar

What's pushed on docker hub right now is not runnable.

Building it locally though does produce a workable container that doesn't have this problem.

Container unreachable externally?

I can't seem to access the docker-tikaserver outside the host it is running on. I'm not sure if this is deliberate or not, but it was unexpected.

As per the README:

docker run -d -p 9998:9998 logicalspark/docker-tikaserver

Will start up fine and is reachable locally both through localhost:9998/tika and [public IP]:9998/tika.

[public IP]:9998/tika is not reachable from outside the host. Other docker images with similar starting parameters are.

Is there any documentation available that shows how to make the docker container accessible externally?

Unable to make request

docker run --name tikaserver -d -p 9998:9998 logicalspark/docker-tikaserver java -jar tika-server-1.19.1.jar -enableUnsecureFeatures -enableFileUrl

HI, im trying to test docker-tikaserver, but when im run this command:

curl -i -X PUT http://localhost:9998/tika -H 'Accept: text/plain' -H 'fileUrl:http://www.pdf995.com/samples/pdf.pdf'

i have this error:

INFO tika (autodetecting type) WARN tika: Text extraction failed org.apache.tika.exception.ZeroByteFileException: InputStream must have > 0 bytes at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:122) at org.apache.tika.server.resource.TikaResource.parse(TikaResource.java:402) at org.apache.tika.server.resource.TikaResource$5.write(TikaResource.java:513) at org.apache.cxf.jaxrs.provider.BinaryDataProvider.writeTo(BinaryDataProvider.java:177) at org.apache.cxf.jaxrs.utils.JAXRSUtils.writeMessageBody(JAXRSUtils.java:1391) at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:246) at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:122) at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:84) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:90) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:247) at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:79) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1317) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:205) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:531) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680) at java.lang.Thread.run(Thread.java:748) ERROR Problem with writing the data, class org.apache.tika.server.resource.TikaResource$5, ContentType: text/plain

Push 1.16 image to docker hub

The current version is missing on docker hub. Can you make a release on github and trigger a build on docker hub?

Fails to build with latest ubuntu

Last time container image was built on docker hub LTS ubuntu version was 14.04 trusty.
But now when I try to build an image locally, FROM ubuntu:latest references to 16.04 xenial release.

It fails to build on the step of installing openjdk:

Package openjdk-7-jre-headless is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'openjdk-7-jre-headless' has no installation candidate

By the way, setting a base image as FROM ubuntu:14.04 let me build image without any issues.

Image tag 1.15 is broken: Error: Invalid or corrupt jarfile /tika-server-1.15.jar

Hey there,

I just tried to use the 1.16 tag from Docker Hub, but it seems to be broken:

sudo docker run --rm -it logicalspark/docker-tikaserver:1.15
Unable to find image 'logicalspark/docker-tikaserver:1.15' locally
1.15: Pulling from logicalspark/docker-tikaserver
75c416ea735c: Pull complete 
c6ff40b6d658: Pull complete 
a7050fc1f338: Pull complete 
f0ffb5cf6ba9: Pull complete 
be232718519c: Pull complete 
1fb511f2b87f: Pull complete 
Digest: sha256:1d25f830709d6575995519bd71981034aa51e4520173023a6259dbdd8f031ac7
Status: Downloaded newer image for logicalspark/docker-tikaserver:1.15
Error: Invalid or corrupt jarfile /tika-server-1.15.jar

Update docker base to ubuntu:focal

Upgrade from bionic to focal, as bionic is two years old (though is LTS). Focal is also a LTS version that was released in April.

This would lead to a bump in the version of tesseract, to their latest release 4.1.1, rather than the version on bionic, 4.0.0. The new version of tesseract includes all fixes and improvements from October 2018 - December 2019.

1.28.4 throws "not enough memory", but 1.28.3 (and older) are okay

I tried out 1.28.4 and get the below error, but it goes away with 1.28.3 ;-)

^Croot@pdf-discovery-demo:~# docker run -p 9998:9998 logicalspark/docker-tikaserver:1.28.4
[0.031s][warning][os,thread] Failed to start thread - pthread_create failed (EPERM) for attributes: stacksize: 1024k, guardsize: 4k, detached.
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create worker GC thread. Out of system resources.
# An error report file with more information is saved as:
# /tmp/hs_err_pid1.log

Tika-Tesseract question

Hi,

I am trying to use TIKA with tesseract in a container. I am using the TIKA jar file and tesseract '.so' files to do this. (instead of installing on the fly)

Is it just setting up the LD_LIBRARY_PATH and it should work ? (I am copying the jar and '.so' files as part of docker file)
I am having issues with this and TIKA is not extracting text out of the image files.

Thanks for your help. Not sure if this question is relevant in this forum ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.