问题:
通过 docker build构建SpringBoot镜像时出现如下问题:
[root@localhost docker]# docker build -t example:1.0.0 .[+] Building 36.0s (3/3) FINISHED => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load build definition from dockerfile 0.0s => => transferring dockerfile: 290B 0.0s => ERROR [internal] load metadata for docker.io/library/java:8 35.9s------ > [internal] load metadata for docker.io/library/java:8:------dockerfile:2-------------------- 1 | 2 | >>> FROM java:8 3 | 4 | MAINTAINER GaoHuanjie--------------------ERROR: failed to solve: java:8: failed to do request: Head "https://ha65u7j9.mirror.aliyuncs.com/v2/library/java/manifests/8?ns=docker.io": dial tcp: lookup ha65u7j9.mirror.aliyuncs.com on 114.114.114.114:53: read udp 192.168.1.101:52193->114.114.114.114:53: i/o timeout[root@localhost docker]#
方案:
该问题由网络不好产生,可以更换网络环境尝试一下,如果还是没有解决,可以通过修改dockerfile文件FROM配置尝试一下,如下所示:
FROM openjdk:8MAINTAINER GaoHuanjieVOLUME /tmpADD dubhe-0.0.1-SNAPSHOT.jar app.jarRUN bash -c 'touch /app.jar'ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
来源地址:https://blog.csdn.net/wangshuxuncom/article/details/131267087