运行docker build时不反映对我的dockerfile的更改 [英] Changes to my dockerfile are not reflected when running `docker build`
问题描述
Docker初学者在这里.我正在尝试通过调用 docker build -t my_image.
并在失败的行上对dockerfile进行更改来构建docker镜像.我目前在此行遇到问题:
Docker beginner here. I'm trying to build a docker image by invoking docker build -t my_image .
and making changes to the dockerfile on lines that fail. I'm currently running into a problem on this line:
运行apt-get install -qy语言环境
之前曾被纠正过的人:
运行apt-get install -q语言环境
(我忘了 -y
假定为"yes"输入.)
RUN apt-get install -q locales
(I forgot the -y
which assumes 'yes' inputs.)
但是,当我再次运行build命令时,似乎未反映出对 -qy
的更改:
But, when I run the build command again, the change to -qy
is seemingly not reflected:
---> Running in bc68a3eec929
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
libc-l10n
The following NEW packages will be installed:
libc-l10n locales
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 4907 kB of archives.
After this operation, 20.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.
The command '/bin/sh -c apt-get install -q locales' returned a non-zero code: 1
我尝试过的事情:
-
删除所有最近停止的容器
Removing any recently stopped containers
删除所有最近生成的图像(全部失败)
Removing any recently built images (which were all failed)
使用 docker build --no-cache -t my_image.
请注意,我没有在dockerfile中使用VOLUME.我看到一些用户对此有疑问,但这不是我的问题.
Note that I do not use VOLUME in the dockerfile. I saw some users had problems with this, but it's not my issue.
简而言之,为什么在构建命令期间无法识别对我的dockerfile的更改?
In short, why are changes to my dockerfile not recognized during the build command?
推荐答案
基于您提到的内容,我认为第一个失败不是由于 -qy
引起的,它一定是由于未更新引起的在运行 apt-get
命令之前,请使用存储库.
Based on what you have mentioned, I think the first failure is not due to -qy
, it must be due to not updating the repos before running the apt-get
commands.
您可以试试看吗?
RUN apt-get update && apt-get install -qy locales
这篇关于运行docker build时不反映对我的dockerfile的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!