运行 update && upgrade 时出现 Dockerfile 错误
Dockerfile error when running update && upgrade
我正在构建我的第一个 docker 文件,需要安装一些包。目前我正在使用 Fedora,我想做的第一件事是 运行 dnf update && upgrade,但是我得到一个错误。
Docker 文件:
# Base image
FROM fedora:28
LABEL description="Intellij community edition 2018"
# Update and Upgrade
RUN dnf update && upgrade -y
错误:
Error: Failed to synchronize cache for repo 'updates'
The command '/bin/sh -c dnf update && upgrade -y' returned a non-zero code: 1
我已经尝试过 dnf 和 yum,并且还使用 ubuntu 作为基础映像,所以我可以尝试使用 apt-get,但我不断收到不同但相似的错误:
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
/bin/sh: 1: upgrade: not found
The command '/bin/sh -c apt-get update && upgrade -y' returned a non-zero code: 127
我已经尝试过这些问题的解决方案,但都没有成功:
How to install multiple packages using apt-get via a Dockerfile
我能做到这一点的唯一方法 运行 是使用 -net=host 参数从一个空容器手动构建。
是否可以直接从 docker 文件安装、更新或升级软件包,如果可以的话怎么办?
在另一个项目上休息了一会儿后,我又回来学习了docker。我仍然不确定是什么导致了错误。但是在构建 docker 文件时,我使用了不同的名称和标签,因为我删除了 image/container 列表。我只能假设这是与某种保留字的冲突。
我正在构建我的第一个 docker 文件,需要安装一些包。目前我正在使用 Fedora,我想做的第一件事是 运行 dnf update && upgrade,但是我得到一个错误。
Docker 文件:
# Base image
FROM fedora:28
LABEL description="Intellij community edition 2018"
# Update and Upgrade
RUN dnf update && upgrade -y
错误:
Error: Failed to synchronize cache for repo 'updates'
The command '/bin/sh -c dnf update && upgrade -y' returned a non-zero code: 1
我已经尝试过 dnf 和 yum,并且还使用 ubuntu 作为基础映像,所以我可以尝试使用 apt-get,但我不断收到不同但相似的错误:
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
/bin/sh: 1: upgrade: not found
The command '/bin/sh -c apt-get update && upgrade -y' returned a non-zero code: 127
我已经尝试过这些问题的解决方案,但都没有成功:
How to install multiple packages using apt-get via a Dockerfile
我能做到这一点的唯一方法 运行 是使用 -net=host 参数从一个空容器手动构建。
是否可以直接从 docker 文件安装、更新或升级软件包,如果可以的话怎么办?
在另一个项目上休息了一会儿后,我又回来学习了docker。我仍然不确定是什么导致了错误。但是在构建 docker 文件时,我使用了不同的名称和标签,因为我删除了 image/container 列表。我只能假设这是与某种保留字的冲突。