You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected restarted=yes to not restart containers which were just created, as the whole point of restarting is that the container runs anew with all previously changed things (mostly changed mounted configfiles, which compose does not know about).
Actual Results
In the example, the mysql entrypoint creating the table gets interrupted, leading to a broken mysql. But I'd like to keep the restart functionality, depending on changed config/compose files.
handlers have the same problem, but the other way around - the handler needs restarted: yes, but shouldn't run initially. Do I really have to find out if the container did not exist before, and guard the restarted against that?
I'd suggest restarted does not restart services which it just now started.
Code of Conduct
I agree to follow the Ansible Code of Conduct
The text was updated successfully, but these errors were encountered:
Good question. The documentation of the state option isn't fully clear whether docker-compose up is ran before docker-compose stop or docker-compose restart or not - the implementation does exactly that, though. I guess part of it is because the implementation wants to make sure that the service is actually in a correct state (i.e. all containers are up and running with the correct configuration etc.) before restating. Changing this in a sensible way is not so easy, I guess.
I use a handler with restarted: true which I expect to start (up) the containers if they are not running already (usually on first deploy), and restart them if they are already running. This is breaking a project that needs to do some things on first run only.
Summary
I am unsure if it's a bug or just an (for me) unexpected behaviour:
When using docker_compose with restarted=yes, the freshly container gets restarted right after creation, often breaking entrypoints and such.
Issue Type
Bug Report
Component Name
docker_compose
Ansible Version
2.11.1 with python 3.10
Community.general Version
community.general 7.0.1
Configuration
not applicable
OS / Environment
debian bullseye
Steps to Reproduce
Expected Results
I expected restarted=yes to not restart containers which were just created, as the whole point of restarting is that the container runs anew with all previously changed things (mostly changed mounted configfiles, which compose does not know about).
Actual Results
In the example, the mysql entrypoint creating the table gets interrupted, leading to a broken mysql. But I'd like to keep the restart functionality, depending on changed config/compose files.
handlers have the same problem, but the other way around - the handler needs
restarted: yes
, but shouldn't run initially. Do I really have to find out if the container did not exist before, and guard the restarted against that?I'd suggest
restarted
does not restart services which it just now started.Code of Conduct
The text was updated successfully, but these errors were encountered: