gpt4 book ai didi

Dockerfile 无法构建

转载 作者:行者123 更新时间:2023-12-04 23:14:56 26 4
gpt4 key购买 nike

直到几天前 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

最佳答案

如果您的主机是 Ubuntu VM,则它可能是无效的 /etc/resolve.conf .看/etc/resolv.conf在主机 Ubuntu VM 上。如果包含 nameserver 127.0.1.1 , 那是错的。

在主机 Ubuntu VM 上运行这些命令来修复它:

sudo vi /etc/NetworkManager/NetworkManager.conf
# Comment out the line `dns=dnsmasq` with a `#`

# restart the network manager service
sudo systemctl restart network-manager

cat /etc/resolv.conf

现在 /etc/resolv.conf nameserver 应该有一个有效的值,它将被 docker 容器复制。

关于Dockerfile 无法构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44842415/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com