You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tika.apache.org by שי ברק <sh...@gmail.com> on 2023/04/27 17:57:01 UTC

Run Tika-docker with custom config

Hey,
I have my custom tika-config.xml on my Desktop.
when I run the following command from my Desktop:

docker run -d -p 127.0.0.1:9998:9998 -v ./tika-config.xml:/tika-config.xml
apache/tika:2.5.0-full --config /tika-config.xml

I get the following error message:

ERROR [main] 17:53:29,564 org.apache.tika.server.core.TikaServerCli Can't
start:
java.io.IOException: Is a directory
        at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?]
        at sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:48)
~[?:?]
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:330) ~[?:?]
        at sun.nio.ch.IOUtil.read(IOUtil.java:296) ~[?:?]
        at sun.nio.ch.IOUtil.read(IOUtil.java:273) ~[?:?]
        at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:232) ~[?:?]
        at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
~[?:?]
        at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:107)
~[?:?]
        at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:101)
~[?:?]
        at java.io.InputStream.read(InputStream.java:218) ~[?:?]
        at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:81)
~[?:?]
        at
org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.readAndBuffer(Unknown
Source) ~[tika-server-standard-2.6.0.jar:2.6.0]
        at
org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
~[tika-server-standard-2.6.0.jar:2.6.0]
        at
org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown
Source) ~[tika-server-standard-2.6.0.jar:2.6.0]
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source) ~[tika-server-standard-2.6.0.jar:2.6.0]
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source) ~[tika-server-standard-2.6.0.jar:2.6.0]
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
~[tika-server-standard-2.6.0.jar:2.6.0]
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
~[tika-server-standard-2.6.0.jar:2.6.0]
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
~[tika-server-standard-2.6.0.jar:2.6.0]
        at
javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:122) ~[?:?]
        at
org.apache.tika.utils.XMLReaderUtils.buildDOM(XMLReaderUtils.java:483)
~[tika-server-standard-2.6.0.jar:2.6.0]
        at org.apache.tika.config.ConfigBase.configure(ConfigBase.java:506)
~[tika-server-standard-2.6.0.jar:2.6.0]
        at
org.apache.tika.server.core.TikaServerConfig.load(TikaServerConfig.java:211)
~[tika-server-standard-2.6.0.jar:2.6.0]
        at
org.apache.tika.server.core.TikaServerConfig.load(TikaServerConfig.java:198)
~[tika-server-standard-2.6.0.jar:2.6.0]
        at
org.apache.tika.server.core.TikaServerConfig.load(TikaServerConfig.java:155)
~[tika-server-standard-2.6.0.jar:2.6.0]
        at
org.apache.tika.server.core.TikaServerCli.main(TikaServerCli.java:77)
~[tika-server-standard-2.6.0.jar:2.6.0]


Does anyone know why?
thanks.

Re: Run Tika-docker with custom config

Posted by שי ברק <sh...@gmail.com>.
Thank you for your help.

On Sat, 29 Apr 2023 at 17:57 Konstantin Gribov <gr...@gmail.com> wrote:

> To override entrypoint use something like:
>
> ```
> FROM apache/tika:2.7.0.1-full
> ADD tika-config.xml /tika-config.xml
> ENTRYPOINT [ "/bin/sh", "-c", "exec java -cp
> \"/tika-server-standard-2.7.0.jar:/tika-extras/*\"
> org.apache.tika.server.core.TikaServerCli -h 0.0.0.0 --config
> /tika-config.xml $0 $@"]
> ```
>
> After that you could build it with `docker build -t tika-custom:latest .`
> and run new with just `docker run -d -p 127.0.0.1:9998:9998
> tika-custom:latest`.
>
> --
> Best regards,
> Konstantin Gribov.
>
>
> ‪On Fri, Apr 28, 2023 at 6:55 PM ‫שי ברק‬‎ <sh...@gmail.com> wrote:‬
>
>> I’m really new to Docker.
>> How should my Dockerfile look like eventually?
>> So far I have these lines:
>> ‘’’
>> FROM apache/tika:2.7.0.1-full
>> ADD tika-config.xml /tika-config.xml
>> ‘’’
>>
>>
>> On Fri, 28 Apr 2023 at 18:44 Nick Burch <ni...@apache.org> wrote:
>>
>>> On Fri, 28 Apr 2023, שי ברק wrote:
>>> > I don’t know if it’s possible but I’m trying to avoid typing this ‘ ––
>>> > config’ when I start the container. I wish to have all of these
>>> settings
>>> > to be written inside the Dockerfile.
>>>
>>> Since you're doing your own custom docker container, you could override
>>> the ENTRYPOINT to specify the Tika Config file by default
>>> https://github.com/apache/tika-docker/blob/master/full/Dockerfile#L77
>>>
>>> Nick
>>
>>

Re: Run Tika-docker with custom config

Posted by Konstantin Gribov <gr...@gmail.com>.
To override entrypoint use something like:

```
FROM apache/tika:2.7.0.1-full
ADD tika-config.xml /tika-config.xml
ENTRYPOINT [ "/bin/sh", "-c", "exec java -cp
\"/tika-server-standard-2.7.0.jar:/tika-extras/*\"
org.apache.tika.server.core.TikaServerCli -h 0.0.0.0 --config
/tika-config.xml $0 $@"]
```

After that you could build it with `docker build -t tika-custom:latest .`
and run new with just `docker run -d -p 127.0.0.1:9998:9998
tika-custom:latest`.

-- 
Best regards,
Konstantin Gribov.


‪On Fri, Apr 28, 2023 at 6:55 PM ‫שי ברק‬‎ <sh...@gmail.com> wrote:‬

> I’m really new to Docker.
> How should my Dockerfile look like eventually?
> So far I have these lines:
> ‘’’
> FROM apache/tika:2.7.0.1-full
> ADD tika-config.xml /tika-config.xml
> ‘’’
>
>
> On Fri, 28 Apr 2023 at 18:44 Nick Burch <ni...@apache.org> wrote:
>
>> On Fri, 28 Apr 2023, שי ברק wrote:
>> > I don’t know if it’s possible but I’m trying to avoid typing this ‘ ––
>> > config’ when I start the container. I wish to have all of these
>> settings
>> > to be written inside the Dockerfile.
>>
>> Since you're doing your own custom docker container, you could override
>> the ENTRYPOINT to specify the Tika Config file by default
>> https://github.com/apache/tika-docker/blob/master/full/Dockerfile#L77
>>
>> Nick
>
>

Re: Run Tika-docker with custom config

Posted by שי ברק <sh...@gmail.com>.
I’m really new to Docker.
How should my Dockerfile look like eventually?
So far I have these lines:
‘’’
FROM apache/tika:2.7.0.1-full
ADD tika-config.xml /tika-config.xml
‘’’


On Fri, 28 Apr 2023 at 18:44 Nick Burch <ni...@apache.org> wrote:

> On Fri, 28 Apr 2023, שי ברק wrote:
> > I don’t know if it’s possible but I’m trying to avoid typing this ‘ ––
> > config’ when I start the container. I wish to have all of these settings
> > to be written inside the Dockerfile.
>
> Since you're doing your own custom docker container, you could override
> the ENTRYPOINT to specify the Tika Config file by default
> https://github.com/apache/tika-docker/blob/master/full/Dockerfile#L77
>
> Nick

Re: Run Tika-docker with custom config

Posted by Nick Burch <ni...@apache.org>.
On Fri, 28 Apr 2023, שי ברק wrote:
> I don’t know if it’s possible but I’m trying to avoid typing this ‘ –– 
> config’ when I start the container. I wish to have all of these settings 
> to be written inside the Dockerfile.

Since you're doing your own custom docker container, you could override 
the ENTRYPOINT to specify the Tika Config file by default
https://github.com/apache/tika-docker/blob/master/full/Dockerfile#L77

Nick

Re: Run Tika-docker with custom config

Posted by שי ברק <sh...@gmail.com>.
I don’t know if it’s possible but I’m trying to avoid typing this ‘ ––
config’ when I start the container.
I wish to have all of these settings to be written inside the Dockerfile.


On Fri, 28 Apr 2023 at 17:59 Nick Burch <ni...@apache.org> wrote:

> On Fri, 28 Apr 2023, שי ברק wrote:
> > Inside the container probably - makes more sense to me
>
> In that case, create a custom Docker container that adds in your custom
> config to your Docker image, as per Konstantin's instructions:
> https://lists.apache.org/thread/l0od2b6tp6odyd661ftjqmkkf27o6hdl
>
> Then when you start your Docker container, tell it the path to your custom
> config file within the container using the --config flag
>
>
> See also https://github.com/apache/tika-docker#custom-config for how to
> have your config outside on the host machine and to mount that in, in case
> you decide to go the other way
>
> Nick

Re: Run Tika-docker with custom config

Posted by Nick Burch <ni...@apache.org>.
On Fri, 28 Apr 2023, שי ברק wrote:
> Inside the container probably - makes more sense to me

In that case, create a custom Docker container that adds in your custom 
config to your Docker image, as per Konstantin's instructions:
https://lists.apache.org/thread/l0od2b6tp6odyd661ftjqmkkf27o6hdl

Then when you start your Docker container, tell it the path to your custom 
config file within the container using the --config flag


See also https://github.com/apache/tika-docker#custom-config for how to 
have your config outside on the host machine and to mount that in, in case 
you decide to go the other way

Nick

Re: Run Tika-docker with custom config

Posted by שי ברק <sh...@gmail.com>.
Inside the container probably - makes more sense to me

On Fri, 28 Apr 2023 at 17:50 Nick Burch <ni...@apache.org> wrote:

> On Fri, 28 Apr 2023, שי ברק wrote:
> > What does the `--config /tika-config.xml` do and how can I, if possible
> > add this flag to my Dockerfile?
>
> Do you want your Tika Config file to live inside the Docker container, or
> outside on the host machine?
>
> Nick

Re: Run Tika-docker with custom config

Posted by Nick Burch <ni...@apache.org>.
On Fri, 28 Apr 2023, שי ברק wrote:
> What does the `--config /tika-config.xml` do and how can I, if possible 
> add this flag to my Dockerfile?

Do you want your Tika Config file to live inside the Docker container, or 
outside on the host machine?

Nick

Re: Run Tika-docker with custom config

Posted by שי ברק <sh...@gmail.com>.
I appreciate your help, it works now.
What does the `--config /tika-config.xml` do and how can I, if possible add
this flag to my Dockerfile?


On Thu, Apr 27, 2023 at 9:11 PM Konstantin Gribov <gr...@gmail.com> wrote:

> Hello.
>
> Most likely that docker couldn't find the tika-config.xml file at the
> directory where you tried to start docker, created tika-config.xml/
> directory and mounted it inside of the container.
>
> If you're using Docker on Windows or MacOS there should be additional
> actions to pass a file into the container.
>
> As a workaround you could create a docker image with your config, just
> create a Dockerfile
>
> ```
> FROM apache/tika:2.7.0.1-full
> ADD tika-config.xml /tika-config.xml
> ```
>
> Then run docker `build -t tika-custom:latest .`, wait for it to finish and
> try that image instead of the apache/tika: `docker run -d -p 127.0.0.1:9998:9998
> tika-custom:latest --config /tika-config.xml`.
>
> --
> Best regards,
> Konstantin Gribov.
>
>
> ‪On Thu, Apr 27, 2023 at 8:54 PM ‫שי ברק‬‎ <sh...@gmail.com> wrote:‬
>
>> Hey,
>> I have my custom tika-config.xml on my Desktop.
>> when I run the following command from my Desktop:
>>
>> docker run -d -p 127.0.0.1:9998:9998 -v
>> ./tika-config.xml:/tika-config.xml apache/tika:2.5.0-full --config
>> /tika-config.xml
>>
>> I get the following error message:
>>
>> ERROR [main] 17:53:29,564 org.apache.tika.server.core.TikaServerCli Can't
>> start:
>> java.io.IOException: Is a directory
>>         at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?]
>>         at sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:48)
>> ~[?:?]
>>         at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:330) ~[?:?]
>>         at sun.nio.ch.IOUtil.read(IOUtil.java:296) ~[?:?]
>>         at sun.nio.ch.IOUtil.read(IOUtil.java:273) ~[?:?]
>>         at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:232)
>> ~[?:?]
>>         at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
>> ~[?:?]
>>         at
>> sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:107) ~[?:?]
>>         at
>> sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:101) ~[?:?]
>>         at java.io.InputStream.read(InputStream.java:218) ~[?:?]
>>         at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:81)
>> ~[?:?]
>>         at
>> org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.readAndBuffer(Unknown
>> Source) ~[tika-server-standard-2.6.0.jar:2.6.0]
>>         at
>> org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
>> ~[tika-server-standard-2.6.0.jar:2.6.0]
>>         at
>> org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown
>> Source) ~[tika-server-standard-2.6.0.jar:2.6.0]
>>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
>> Source) ~[tika-server-standard-2.6.0.jar:2.6.0]
>>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
>> Source) ~[tika-server-standard-2.6.0.jar:2.6.0]
>>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>> ~[tika-server-standard-2.6.0.jar:2.6.0]
>>         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
>> ~[tika-server-standard-2.6.0.jar:2.6.0]
>>         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown
>> Source) ~[tika-server-standard-2.6.0.jar:2.6.0]
>>         at
>> javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:122) ~[?:?]
>>         at
>> org.apache.tika.utils.XMLReaderUtils.buildDOM(XMLReaderUtils.java:483)
>> ~[tika-server-standard-2.6.0.jar:2.6.0]
>>         at
>> org.apache.tika.config.ConfigBase.configure(ConfigBase.java:506)
>> ~[tika-server-standard-2.6.0.jar:2.6.0]
>>         at
>> org.apache.tika.server.core.TikaServerConfig.load(TikaServerConfig.java:211)
>> ~[tika-server-standard-2.6.0.jar:2.6.0]
>>         at
>> org.apache.tika.server.core.TikaServerConfig.load(TikaServerConfig.java:198)
>> ~[tika-server-standard-2.6.0.jar:2.6.0]
>>         at
>> org.apache.tika.server.core.TikaServerConfig.load(TikaServerConfig.java:155)
>> ~[tika-server-standard-2.6.0.jar:2.6.0]
>>         at
>> org.apache.tika.server.core.TikaServerCli.main(TikaServerCli.java:77)
>> ~[tika-server-standard-2.6.0.jar:2.6.0]
>>
>>
>> Does anyone know why?
>> thanks.
>>
>

Re: Run Tika-docker with custom config

Posted by Konstantin Gribov <gr...@gmail.com>.
Hello.

Most likely that docker couldn't find the tika-config.xml file at the
directory where you tried to start docker, created tika-config.xml/
directory and mounted it inside of the container.

If you're using Docker on Windows or MacOS there should be additional
actions to pass a file into the container.

As a workaround you could create a docker image with your config, just
create a Dockerfile

```
FROM apache/tika:2.7.0.1-full
ADD tika-config.xml /tika-config.xml
```

Then run docker `build -t tika-custom:latest .`, wait for it to finish and
try that image instead of the apache/tika: `docker run -d -p
127.0.0.1:9998:9998
tika-custom:latest --config /tika-config.xml`.

-- 
Best regards,
Konstantin Gribov.


‪On Thu, Apr 27, 2023 at 8:54 PM ‫שי ברק‬‎ <sh...@gmail.com> wrote:‬

> Hey,
> I have my custom tika-config.xml on my Desktop.
> when I run the following command from my Desktop:
>
> docker run -d -p 127.0.0.1:9998:9998 -v
> ./tika-config.xml:/tika-config.xml apache/tika:2.5.0-full --config
> /tika-config.xml
>
> I get the following error message:
>
> ERROR [main] 17:53:29,564 org.apache.tika.server.core.TikaServerCli Can't
> start:
> java.io.IOException: Is a directory
>         at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?]
>         at sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:48)
> ~[?:?]
>         at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:330) ~[?:?]
>         at sun.nio.ch.IOUtil.read(IOUtil.java:296) ~[?:?]
>         at sun.nio.ch.IOUtil.read(IOUtil.java:273) ~[?:?]
>         at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:232) ~[?:?]
>         at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
> ~[?:?]
>         at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:107)
> ~[?:?]
>         at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:101)
> ~[?:?]
>         at java.io.InputStream.read(InputStream.java:218) ~[?:?]
>         at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:81)
> ~[?:?]
>         at
> org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.readAndBuffer(Unknown
> Source) ~[tika-server-standard-2.6.0.jar:2.6.0]
>         at
> org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
> ~[tika-server-standard-2.6.0.jar:2.6.0]
>         at
> org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown
> Source) ~[tika-server-standard-2.6.0.jar:2.6.0]
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> Source) ~[tika-server-standard-2.6.0.jar:2.6.0]
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> Source) ~[tika-server-standard-2.6.0.jar:2.6.0]
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> ~[tika-server-standard-2.6.0.jar:2.6.0]
>         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
> ~[tika-server-standard-2.6.0.jar:2.6.0]
>         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown
> Source) ~[tika-server-standard-2.6.0.jar:2.6.0]
>         at
> javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:122) ~[?:?]
>         at
> org.apache.tika.utils.XMLReaderUtils.buildDOM(XMLReaderUtils.java:483)
> ~[tika-server-standard-2.6.0.jar:2.6.0]
>         at
> org.apache.tika.config.ConfigBase.configure(ConfigBase.java:506)
> ~[tika-server-standard-2.6.0.jar:2.6.0]
>         at
> org.apache.tika.server.core.TikaServerConfig.load(TikaServerConfig.java:211)
> ~[tika-server-standard-2.6.0.jar:2.6.0]
>         at
> org.apache.tika.server.core.TikaServerConfig.load(TikaServerConfig.java:198)
> ~[tika-server-standard-2.6.0.jar:2.6.0]
>         at
> org.apache.tika.server.core.TikaServerConfig.load(TikaServerConfig.java:155)
> ~[tika-server-standard-2.6.0.jar:2.6.0]
>         at
> org.apache.tika.server.core.TikaServerCli.main(TikaServerCli.java:77)
> ~[tika-server-standard-2.6.0.jar:2.6.0]
>
>
> Does anyone know why?
> thanks.
>