docker-compose 未显示任何代码更改 [英] docker-compose not showing any changes to code
问题描述
我正在开发一个使用 docker-compose up
启动和运行的项目.我对 docker-compose 不是很熟悉,我在文档中找不到答案.根据文档,up
命令从 docker 文件重建容器,但这似乎没有发生.
I am working on a project that uses docker-compose up
to start up and run. I am not very familiar with docker-compose and I couldn't really find an answer in the docs. According to the docs the up
command rebuilds the container from the docker file, however this does not seem to happen.
当我尝试添加用于调试的 print
命令时,没有任何反应.该程序已经抛出了一些打印命令,我尝试更改它们以确保它们始终打印相同.我是否必须在 up
命令中添加一些东西来重建容器?
When I try to add print
commands for debugging nothing happens. The program already throws a few print commands and I tried changing those to be sure, and they always print the same. Do I have to add something to the up
command to make the container rebuild?
docker-compose/yml:
docker-compose/yml:
dockbrato:
build: .
volumes:
- "/sys:/sys"
- "/var/run/docker.sock:/var/run/docker.sock"
推荐答案
据我所知,docker-compose up
只构建不存在的图像;它不会重建源已更改的映像.如果要重建镜像,请在 docker-compose up
之前运行 docker-compose build
.
As far as I can tell, docker-compose up
only builds images that don't exist already; it will not rebuild an image whose source has changed. If you want to rebuild your image, run docker-compose build
before docker-compose up
.
这篇关于docker-compose 未显示任何代码更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!