dockerboot2dockerstardog

File copied by Docker seen as a directory


I'm trying to dockerize a Stardog 3.1.3 community edition server. The container fails to start because it sees a directory instead of a license file. For the record, I'm on Windows. These are the steps I'm following:

Create a data container

docker create -v /data/stardog:/data/stardog --name stardog_data busybox /bin/true

Copy the local license key to the data container (not done in the Dockerfile that is mentioned below as the license is environment specific)

docker cp .\stardog\stardog-license-key.bin stardog_data:/stardog-license-key.bin

Create an image based on the following Dockerfile

docker build -t me/stardog .


FROM java:openjdk-8-jdk

ENV STARDOG_VER stardog-3.1.3
ENV STARDOG_HOME /data/stardog

COPY ${LOCAL_PATH}/${STARDOG_VER}.zip /
RUN unzip ${STARDOG_VER}.zip

WORKDIR /${STARDOG_VER}

CMD rm $STARDOG_HOME/system.lock || true && bin/stardog-admin server start && (tail -f $STARDOG_HOME/stardog.log &) && while (pidof java > /dev/null); do sleep 1; done

Run a Stardog container

docker run -d -p 5820:5820 --volumes-from stardog_data --name stardog me/stardog

When I execute docker ps -a, I see that the container is stopped after a couple of seconds:

CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS                      PORTS                    NAMES
9559b22473e1        me/stardog               "/bin/sh -c 'rm $STAR"   26 minutes ago      Exited (1) 26 minutes ago                            stardog
2b929329e35e        busybox                  "/bin/true"              32 minutes ago      Created                                              stardog_data

When I check the logs with docker logs stardog, I'm getting this:

com.clarkparsia.license.InvalidLicenseException: java.io.FileNotFoundException: /data/stardog/stardog-license-key.bin (Is a directory)
        at com.clarkparsia.license.LicenseValidator.validate(LicenseValidator.java:157)
        at com.complexible.stardog.StardogLicense.findLicense(StardogLicense.java:127)
        at com.complexible.stardog.StardogLicense.<init>(StardogLicense.java:70)
        at com.complexible.stardog.Stardog.<init>(Stardog.java:158)
        at com.complexible.stardog.Stardog.initialize(Stardog.java:263)
        at com.complexible.stardog.Stardog.initialize(Stardog.java:254)
        at com.complexible.stardog.Stardog.buildServer(Stardog.java:247)
        at com.complexible.stardog.cli.impl.ServerStart.call(ServerStart.java:144)
        at com.complexible.stardog.cli.impl.ServerStart.call(ServerStart.java:47)
        at com.complexible.stardog.cli.CLIBase.execute(CLIBase.java:54)
        at com.complexible.stardog.cli.admin.CLI.main(CLI.java:194)
Caused by: java.io.FileNotFoundException: /data/stardog/stardog-license-key.bin (Is a directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at com.clarkparsia.license.LicenseValidator.validate(LicenseValidator.java:113)
        ... 10 more
Your Stardog license is invalid.  Please contact support@clarkparsia.com for information on obtaining a new license.

It seems that the license file is considered to be a directory. What am I doing wrong?

I'm using the following Docker version:

Client:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   20f81dd
 Built:        Thu Mar 10 21:49:11 2016
 OS/Arch:      windows/amd64

Server:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   20f81dd
 Built:        Thu Mar 10 21:49:11 2016
 OS/Arch:      linux/amd64

Solution

  • This seems to be a Windows related problem. I've tried these exact same steps on a native Ubuntu (14.04) machine and it works as expected. I've filed this as a bug and hopefully this gets fixed soon.