我正在尝试通过从其git存储库中克隆它来构建Java API for docker,然后使用maven构建如下:
mvn clean install -DskipTests=false -Ddocker.io.username=username -Ddocker.io.password=password -Ddocker.io.email=my@email.id
但是,构建测试失败,导致以下错误消息:
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.
粘贴完整输出here。
我尝试使用以下方法从docker hub中提取busybox图像:
sudo docker pull busybox
,它会产生以下消息:
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
我假设成功下载了busybox图像。但是,尝试重建Java API会导致出现相同的错误消息。
如何解决此问题并成功构建Java API?
系统规格:
主机:Ubuntu 14.04 Trusty Tahr LTS
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
答案 0 :(得分:1)
java API配置为使用Docker 1.1运行,尝试更新Docker。
Docker的Java API客户端
支持Docker Client API v1.13,Docker Server版本1.1
的子集docker-java的开发人员论坛
查看官方网站上的说明:https://docs.docker.com/installation/ubuntulinux/#ubuntu-trusty-1404-lts-64-bit
确保您有openjdk用于开发。
sudo apt-get install openjdk-7-jdk
然后将您的JAVA_HOME环境变量更改为指向/usr/lib/jvm/java-7-openjdk-amd64/
您正在使用不是为此目的制作的JRE,而且似乎是错误的。