sbt失败下载在运行play docker容器 [英] sbt failed download in running play docker container

查看:130
本文介绍了sbt失败下载在运行play docker容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功构建了我的码头图像,一个 play-java 。但是在尝试使用 docker运行-p 0.0.0.0:9000:9000 egima / play激活程序运行 sbt时,无法下载一个特定的依赖项来生成一个容器。日志如下所示:

  ==== Maven2本地:尝试
文件:/root/.m2/ repository / org / sonatype / sisu / sisu-guice / 3.1.0 / sisu-guice-3.1.0.jar
==== Apache Repository:尝试https://repository.apache.org/content/repositories /releases/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0.jar [0m
:::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ^ ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::
:: org.sonatype.sisu#sisu-guice; 3.1.0!sisu-guice.jar
:::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

注意尝试存储库。我遵循了所有不同的变体为了在我的机器上包含本地 c $ c> maven repos,我从日志中确认sbt根据我在本地maven库中指定的内容进行检查,但没有运气。


我的解析器在 build.sbt /project/plugins.sbt 中:

 解析器++ = Seq(
Resolver.sonatypeRepo(public),
Resolver.mavenLocal,
Apache Repository在https://repository.apache.org/content/repositories/releases/

我还检查了我的本地maven repo,以确保缺少的依赖关系存在。缺少什么?

解决方案

VonC 在评论部分建议在 Dockerfile 中添加以下步骤:

 运行ln -s /C/Users/me/.m2 /root/.m2 

我相信这个命令应该在我的主机上的解决路径 Resolver.mavenLocal 之间的 $ MAVEN_HOME 之间建立一个软链接它解析为 /root/.m2

这应该是解决方案。但是,在尝试之后,我意识到虚拟机内可见的共享路径 / c / Users / me (不知道为什么大写C,不知道为什么)在容器内因此,在 Dockerfile 中包含该行将会给我:

  ln:can not访问/c/Users/me/.m2:没有这样的文件或目录

此外, code> RUN ls / root 会给我一个类似的错误,意思是目的地路径目前还不存在。


我自己的推论是该解决方案在于通过任何可用的方法将主机路径安装到目标路径上,我认为这是一个讨论较多的主题。因为在 docker运行中与 -v 标志解决的特定情况执行挂载问题。


这是我使用的确切命令:

  docker run -v / c /Users/me/.m2:/root/.m2 -p 0.0.0.0:9000:9000 egima / play激活器运行

我写过一个完整的博文关于他需要更多信息的人。


I have successfully built my docker image for a play-java. But while trying to spawn a container for it with docker run -p 0.0.0.0:9000:9000 egima/play activator run sbt fails to download one particular dependency. The log looks like this:

==== Maven2 Local: tried
  file:/root/.m2/repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0.jar
==== Apache Repository: tried  https://repository.apache.org/content/repositories/releases/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0.jar[0m
    ::::::::::::::::::::::::::::::::::::::::::::::
    ::              FAILED DOWNLOADS            ::
    :: ^ see resolution messages for details  ^ ::
    ::::::::::::::::::::::::::::::::::::::::::::::
    :: org.sonatype.sisu#sisu-guice;3.1.0!sisu-guice.jar
    ::::::::::::::::::::::::::::::::::::::::::::::

Notice the the tried repositories. I have followed all the different variants for including the local maven repos on my machine, I confirm from the logs that sbt checks according to what I have specified in the local maven repos but no luck.

My resolvers in both build.sbt and /project/plugins.sbt:

resolvers ++=Seq(
    Resolver.sonatypeRepo("public"),
    Resolver.mavenLocal,
    "Apache Repository" at "https://repository.apache.org/content/repositories/releases/"
    )

I also checked my local maven repo to ensure the missing dependency exists. What is missing?

解决方案

VonC suggested in the comments section to add the following step in Dockerfile:

RUN ln -s /C/Users/me/.m2 /root/.m2

I believe this command should establish a soft link between $MAVEN_HOME on my host machine and the resolution path Resolver.mavenLocal which resolves to /root/.m2.

This should be the solution. However, after trying it, I realized that the shared path /c/Users/me(invisible with capital C, don't know why) is visible inside the VM but invisible inside a container. So including that line inside Dockerfile would give me:

ln:cannot access /c/Users/me/.m2: No such file or directory

Additionally, even performing RUN ls /root would give me a similar error meaning the destination path too does not yet exist at this time.

My own deduction is that the solution lies in mounting the host path onto the destination path by any method available which I think is a well discussed topic on this forum. For my particular situation performing a mount during docker run with the -v flag solved the problem.

This is the exact command I used:

docker run -v /c/Users/me/.m2:/root/.m2 -p 0.0.0.0:9000:9000 egima/play activator run

I have written a complete blog post about his for those that need more information.

这篇关于sbt失败下载在运行play docker容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆