【问题标题】:Docker java api maven Build error: busybox is an unrecognized image. Please pull the image firstDocker java api maven 构建错误:busybox 是无法识别的图像。请先拉图
【发布时间】:2014-08-19 13:25:13
【问题描述】:

我正在尝试通过从其 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

【问题讨论】:

    标签: maven docker java dockerhub


    【解决方案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 不是为此目的而设计的,而且似乎有问题。

    【讨论】:

    • 正在尝试升级,完成后将立即恢复。谢谢! :)
    • 使用您提供的链接提供的说明进行了升级,但错误消息仍然保持不变。然而sudo docker version 的输出现在是:Client version: 1.1.2 Client API version: 1.13 Go version (client): go1.2.1 Git commit (client): d84a070 Server version: 1.1.2 Server API version: 1.13 Go version (server): go1.2.1 Git commit (server): d84a070
    • @i08in 我克隆了 git repo。并且没有任何问题地构建它。您的 JAVA_HOME 环境变量是否配置正确?你的 maven 和 java 文件是最新的吗?
    • 是的,JAVA_HOME 已设置为 /usr/lib/jvm/java-7-openjdk-amd64/,maven 版本为Apache Maven 2.2.1 (rdebian-14) Java version: 1.7.0_55 Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux" version: "3.13.0-34-generic" arch: "amd64" Family: "unix" java 为java version "1.7.0_55" OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1) OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode),javac 版本为javac 1.7.0_55
    • 我发现我已经安装了maven 2,升级到3.0.5,但错误仍然存​​在。我还观察到在输出的早期出现了一个警告:[WARNING] The POM for org.apache.httpcomponents:httpclient:jar:4.1.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details [WARNING] The POM for com.sun.jersey:jersey-client:jar:1.9 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
    猜你喜欢
    • 2015-12-18
    • 1970-01-01
    • 2021-08-01
    • 2021-12-23
    • 1970-01-01
    • 2016-12-22
    • 2021-05-19
    • 2022-07-21
    • 1970-01-01
    相关资源
    最近更新 更多