如果我对docker-compose.yml
进行更改,例如command
,则在使用docker-compose run
时不会自动获取这些更改。
我可以通过使用docker-compose down -v --remove-orphans
来强制它检测这些变化。
任何想法为什么这不会自动应用?
没关系,这是因为run
不会检测到更改,但up
会
奇怪的是,我还对docker-compose.yml
进行了一些更改,尝试运行 docker-compose up 但这些更改没有被采纳。
这些变化是:
ADD nginx_app.conf /etc/nginx/sites-enabled/
CMD systemctl reload nginx
@NinoSkopac如果您对Dockerfile
进行更改,则需要再次运行docker-compose build
。
$ docker-compose build --help
Build or rebuild services.
Services are built once and then tagged as `project_service`,
e.g. `composetest_db`. If you change a service's `Dockerfile` or the
contents of its build directory, you can run `docker-compose build` to rebuild it.
...
最有用的评论
没关系,这是因为
run
不会检测到更改,但up
会