简体   繁体   English

Docker构建在下载期间挂起

[英]Docker build hangs during downloads

Mac 10.10.5 here, using docker-machine to create a VirtualBox host VM for my local Docker. Mac 10.10.5在这里,使用docker-machine为我的本地Docker创建一个VirtualBox主机VM。 I have a project that builds an executable JVM located at build/libs/myapp-SNAPSHOT.jar . 我有一个项目,它构建一个位于build/libs/myapp-SNAPSHOT.jar的可执行JVM。 My Dockerfile , which is located in the root of the project, looks like: 我的Dockerfile位于项目的根目录中,如下所示:

FROM frolvlad/alpine-oraclejdk8:slim
VOLUME /tmp
ADD build/libs/myapp-SNAPSHOT.jar myapp.jar
RUN sh -c 'touch /myapp.jar'
ENTRYPOINT ["java","-jar","/myapp.jar"]

Please note, I don't wish to push my images to any registry, just keep/run them locally (for now). 请注意,我不希望我的图像送到任何注册表,只需在本地保存/运行它们(暂时)。 When I run: 当我跑:

docker build -t myorg/myapp .

I get the following console output: 我得到以下控制台输出:

myuser@mymachine:~/sandbox/myapp$docker build -t myorg/myapp .
Sending build context to Docker daemon 42.69 MB
Step 1 : FROM frolvlad/alpine-oraclejdk8:slim
slim: Pulling from frolvlad/alpine-oraclejdk8

d0ca440e8637: Downloading [=================================================> ] 2.295 MB/2.32 MB
0f86278f6be1: Downloading [=================================================> ] 3.149 MB/3.172 MB
c704a6161dca: Download complete 

And then the command-line just hangs after printing that " Download complete " message. 然后命令行在打印“ 下载完成 ”消息后挂起。 I've waited for as long as 30 minutes (!!!) and nothing happens. 我等了30分钟(!!!)并没有任何反应。

Any ideas where I'm going awry? 我出错的任何想法?

The VM is probably hanging. 虚拟机可能正在挂起。 Try the following: https://github.com/docker/machine/issues/1819#issuecomment-138981139 请尝试以下操作: https//github.com/docker/machine/issues/1819#issuecomment-138981139

docker-machine rm -f default
rm -fv ~/.docker/machine
docker-machine -D create -d virtualbox default

There are more issues about this on OSX. 在OSX上有更多关于此的问题。

I think the best practice is to setup a Linux native build box if you are doing any serious development. 我认为,如果您正在进行任何认真的开发,最佳做法是设置Linux本机构建框。 That way you can run docker without any VM overhead(which is ironically one of the major pain points docker is trying to solve) 这样你就可以在没有任何VM开销的情况下运行docker(具有讽刺意味的是Docker试图解决的主要难点之一)

There's also a Docker Beta program which runs on libcontainer natively on OSX and Windows. 还有一个Docker Beta程序 ,可以在OSX和Windows上本地运行libcontainer。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM