当前位置: 首页 > 面试题库 >

Dockerfile无法构建

萧永望
2023-03-14
问题内容

直到几天前,它仍能Dockerfile正常工作,而当我今天再次尝试构建它时,终端中出现以下错误。我尝试使用多个docker基本映像,但仍给出相同的错误。谁能帮我这个?我不认为我错过了任何东西。如果我错过了,应该早点给我错误,但是现在为什么呢?

Err:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu xenial InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package software-properties-common

而我的docker版本是 Docker version 17.03.2-ce, build f5ec1e2

这是我的 Dockerfile

FROM ubuntu:16.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y && \
    apt-get install -y software-properties-common && \
    apt-add-repository ppa:webupd8team/java && \
    apt-get update -y && \
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 && \
    echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \
    apt-get install -y oracle-java8-installer && \
    apt-get install -y oracle-java8-unlimited-jce-policy && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* && \
    rm -rf /var/cache/oracle-jdk8-installer

ENV JAVA_HOME /usr/lib/jvm/java-8-oracle

问题答案:

我刚刚更改了VM Player网络设置。Network Connection从更改为bridged mode to NAT。现在工作了



 类似资料:
  • 我试图使用谷歌云构建触发器构建我的docker容器。不幸的是,构建没有找到我的docker文件。它不在我的存储库的根目录下,但我认为我可以指定一个相对路径。显然我配置错误了。下面是我的cloudbuild.yaml和输出日志。 如果有关系的话——我的代码在github中,但我将触发器配置为从该回购中提取。 日志:

  • Docker 为我们提供了 Dockerfile 来解决自动化的问题。我们将介绍什么是 Dockerfile,它能够做到的事情以及 Dockerfile 的一些基本语法。 Dockerfile 的语法规则 Dockerfile 包含创建镜像所需要的全部指令。基于在 Dockerfile 中的指令,我们可以使用 Docker build 命令来创建镜像。通过减少镜像和容器的创建过程来简化部署。 Do

  • 多阶段构建 之前的做法 在 Docker 17.05 版本之前,我们构建 Docker 镜像时,通常会采用两种方式: 全部放入一个 Dockerfile 一种方式是将所有的构建过程编包含在一个 Dockerfile 中,包括项目及其依赖库的编译、测试、打包等流程,这里可能会带来的一些问题: 镜像层次多,镜像体积较大,部署时间变长 源代码存在泄露的风险 例如,编写 app.go 文件,该程序输出 H

  • 我在尝试使用“在Docker容器内构建”功能在Jenkins中构建一个项目时遇到了以下问题。 通过在工作区中构建用户用户名LastName开始/opt/bitnami/apps/jenkins/jenkins_home/jobs/app/workspace/opt/bitnami/Git/bin/Git rev-parse--is-inside-work-tree#timeout=10从远程Git

  • 我一直在阅读docs编写Dockerfiles的最佳实践。我遇到了小错误(IMHO),在进一步阅读后,其含义很清楚: 在RUN语句中单独使用apt-get更新会导致缓存问题和后续apt-get安装指令失败。 我想知道为什么失败。后来解释了他们所说的“失败”是什么意思: 由于apt get更新未运行,您的构建可能会获得过时版本的curl和nginx包。 但是,对于以下内容,我仍然无法理解他们所说的“

  • 我已经创建了一个简单的Micronaut应用程序,使用 mn创建应用程序app_name--构建maven 用JDK 11以防万一。 这将创建一个maven项目,该项目可以很好地编译,但包含一个,如下所示: 但是,Maven AFAICT中没有docker构建。 所以我包括了这个 它确实能够构建docker映像,但不需要手动干预。原因是在中,在中创建了三个jar: 应用程序名称-0.1。罐子 应用