通过Dockerfile创建项目部署镜像超时

    技术2024-12-22  16

    首先将j项目jar包和Dockerfile文件:放于目录 /var/lib/docker/tmp 我的Dockerfile文件: FROM java:8 EXPOSE 8080 VOLUME /tmp ENV TZ=Asia/Shanghai RUN ln- sf /usr/share/zoneinfo/{TZ} /etc/locatime && echo “{TZ}” > /etc/timezone ADD myshop.war /app.jar RUN bash -c ‘touch /app.jar’ ENTRYPOINT “java”,"-jar",“app.jar” 运行命令 docker build -t myshop . 运行结果 Sending build context to Docker daemon 3.072kB Step 1/8 : FROM java:8 Get https://registry-1.docker.io/v2/library/java/manifests/8: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fjava%3Apull&service=registry.docker.io: net/http: TLS handshake timeout 错误分析:步骤1即出错,文件在基础镜像 java:8,查看是否镜像不存在或镜像名出错 更正或下载基础镜像后重新创建镜像(FROM jdk8) 创建成功

    Processed: 0.016, SQL: 9