2
votes

I am trying to build the Java API for docker by cloning it from its git repository and then building using maven as follows:

mvn clean install -DskipTests=false -Ddocker.io.username=username -Ddocker.io.password=password [email protected]

However, the build test fails resulting in the following error message:

Results :

Failed tests: 
  testRunShlex(com.github.dockerjava.client.DockerClientTest): busybox is an unrecognized image. Please pull the image first.
  testAuth(com.github.dockerjava.client.command.AuthCmdTest): com.sun.jersey.api.client.UniformInterfaceException: Client response status: 404
  testAuthInvalid(com.github.dockerjava.client.command.AuthCmdTest): expected:<401> but was:<404>
  testAddAndCopySubstitution(com.github.dockerjava.client.command.BuildImageCmdTest): 
  testDockerBuilderAddFileInSubfolder(com.github.dockerjava.client.command.BuildImageCmdTest): 
  testDockerBuilderAddFolder(com.github.dockerjava.client.command.BuildImageCmdTest): 
  testDockerBuilderAddUrl(com.github.dockerjava.client.command.BuildImageCmdTest): 
  testNetCatDockerfileBuilder(com.github.dockerjava.client.command.BuildImageCmdTest): 
  testNginxDockerfileBuilder(com.github.dockerjava.client.command.BuildImageCmdTest): 
  commit(com.github.dockerjava.client.command.CommitCmdTest): busybox is an unrecognized image. Please pull the image first.
  testDiff(com.github.dockerjava.client.command.ContainerDiffCmdTest): busybox is an unrecognized image. Please pull the image first.
  copyFromContainer(com.github.dockerjava.client.command.CopyFileFromContainerCmdTest): busybox is an unrecognized image. Please pull the image first.
  createContainerWithEnv(com.github.dockerjava.client.command.CreateContainerCmdTest): busybox is an unrecognized image. Please pull the image first.
  createContainerWithHostname(com.github.dockerjava.client.command.CreateContainerCmdTest): busybox is an unrecognized image. Please pull the image first.
  createContainerWithVolume(com.github.dockerjava.client.command.CreateContainerCmdTest): busybox is an unrecognized image. Please pull the image first.
  info(com.github.dockerjava.client.command.InfoCmdTest): busybox is an unrecognized image. Please pull the image first.
  testKillContainer(com.github.dockerjava.client.command.KillContainerCmdTest): busybox is an unrecognized image. Please pull the image first.
  testListContainers(com.github.dockerjava.client.command.ListContainersCmdTest): Client response status: 404
  listImages(com.github.dockerjava.client.command.ListImagesCmdTest)
  logContainer(com.github.dockerjava.client.command.LogContainerCmdTest): busybox is an unrecognized image. Please pull the image first.
  testPullImage(com.github.dockerjava.client.command.PullImageCmdTest): com.sun.jersey.api.client.UniformInterfaceException: Client response status: 404
  testNotExistentImage(com.github.dockerjava.client.command.PushImageCmdTest): 
  testPushLatest(com.github.dockerjava.client.command.PushImageCmdTest): busybox is an unrecognized image. Please pull the image first.
  removeContainer(com.github.dockerjava.client.command.RemoveContainerCmdTest): busybox is an unrecognized image. Please pull the image first.
  testRemoveImage(com.github.dockerjava.client.command.RemoveImageCmdTest): busybox is an unrecognized image. Please pull the image first.
  restartContainer(com.github.dockerjava.client.command.RestartContainerCmdTest): busybox is an unrecognized image. Please pull the image first.
  searchImages(com.github.dockerjava.client.command.SearchImagesCmdTest): com.sun.jersey.api.client.UniformInterfaceException: Client response status: 404
  startContainer(com.github.dockerjava.client.command.StartContainerCmdTest): busybox is an unrecognized image. Please pull the image first.
  startContainerWithLinking(com.github.dockerjava.client.command.StartContainerCmdTest): busybox is an unrecognized image. Please pull the image first.
  startContainerWithPortBindings(com.github.dockerjava.client.command.StartContainerCmdTest): busybox is an unrecognized image. Please pull the image first.
  startContainerWithVolumes(com.github.dockerjava.client.command.StartContainerCmdTest): busybox is an unrecognized image. Please pull the image first.
  testStopContainer(com.github.dockerjava.client.command.StopContainerCmdTest): busybox is an unrecognized image. Please pull the image first.
  testTagImage(com.github.dockerjava.client.command.TagImageCmdTest): 
  version(com.github.dockerjava.client.command.VersionCmdTest): com.sun.jersey.api.client.UniformInterfaceException: Client response status: 404
  testWaitContainer(com.github.dockerjava.client.command.WaitContainerCmdTest): busybox is an unrecognized image. Please pull the image first.

Tests run: 35, Failures: 35, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.

Pasted the complete output here.

I tried pulling busybox image from docker hub using:

sudo docker pull busybox

and it results in the following message:

Pulling repository busybox
fd5373b3d938: Download complete 
d200959a3e91: Download complete 
37fca75d01ff: Download complete 
a9eb17255234: Download complete 
511136ea3c5a: Download complete 
42eed7f1bf2a: Download complete 
120e218dd395: Download complete 
f06b02872d52: Download complete 
c120b7cab0b0: Download complete 
1f5049b3536e: Download complete 

which I assume successfully downloads busybox image. However, trying to rebuild the Java API results in the same error message.

How can I resolve this and build the Java API successfully?


System specifications:

Host machine: Ubuntu 14.04 Trusty Tahr LTS

The output of sudo docker version:

Client version: 0.9.1
Go version (client): go1.2.1
Git commit (client): 3600720
Server version: 0.9.1
Git commit (server): 3600720
Go version (server): go1.2.1
Last stable version: 1.1.2, please update docker
1

1 Answers

1
votes

The java API is configured to run using Docker 1.1, try updating Docker.

Java API client for Docker

Supports a subset of the Docker Client API v1.13, Docker Server version 1.1

Developer forum for docker-java

Check the instruction on the official site : https://docs.docker.com/installation/ubuntulinux/#ubuntu-trusty-1404-lts-64-bit

Make sure you have openjdk for development.

sudo apt-get install openjdk-7-jdk

Then change your JAVA_HOME environment variable to point to /usr/lib/jvm/java-7-openjdk-amd64/

You are using the JRE which is not made for that purpose and seem to be buggy.