我遇到了一个问题,在发出 docker build 命令时收到以下错误:-
curl: (6) Could not resolve host: dl.yarnpkg.com
gpg: no valid OpenPGP data found.
Run Code Online (Sandbox Code Playgroud)
这是我的 Dockerbuild 文件
# Base image
FROM ruby:2.5.0
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee
/etc/apt/sources.list.d/yarn.lisT
RUN apt-get update
RUN apt-get install -qq -y build-essential libpq-dev nodejs yarn
Run Code Online (Sandbox Code Playgroud)
在 docker 之外运行时,这些命令会成功完成。
为了解决这些问题,我尝试了以下方法
我已经尝试过来自 Google 和 OpenDNS 的 DNS 服务器,以及多个 ISP,具体取决于我运行命令的位置
笔记本电脑运行 Ubuntu 16:04,Docker 版本为 18.06.0-ce,安装了 build 0ffa825。
使用以下也失败
FROM ruby:2.5.0
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
Run Code Online (Sandbox Code Playgroud)
导致以下错误
W: Failed to fetch http://deb.debian.org/debian/dists/stretch/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://security.debian.org/dists/stretch/updates/InRelease Temporary failure resolving 'security.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Run Code Online (Sandbox Code Playgroud)
所以我知道这不仅仅是 dl.yarnpkg.com 主机的问题。
使用 no-cache 选项运行 docker build 命令没有区别。
我在 Ubuntu 16.04 上使用 Docker,有时我也有名称解析问题。
唯一能通过的是--network=host在构建时添加。我不确定发生了什么,但似乎需要使用您的计算机名称解析功能。我希望它有帮助。
| 归档时间: |
|
| 查看次数: |
3654 次 |
| 最近记录: |