我正在构建我的第一个dockerfile,需要安装一些软件包。目前,我正在使用Fedora,我想做的第一件事是运行dnf update && upgrade,但出现错误。
Dockerfile:
# 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
我已经尝试了解决这些问题的方法,但是都没有起作用:
The command '/bin/sh -c returned a non-zero code: 127
How to install multiple packages using apt-get via a Dockerfile
运行此命令的唯一方法是使用-net = host参数从空容器中手动构建。
是否甚至可以直接从docker文件安装,更新或升级软件包,如果可以,怎么办?
答案 0 :(得分:0)
在完成另一个项目不久之后,我又回到了学习docker的领域。我仍然不确定是什么导致了错误。但是在构建dockerfile时,我已经使用了不同的名称和标签,因为我已经删除了图像/容器列表。我只能认为这是与某种保留字的冲突。