Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Documentation: podman_container] The behavior of the state key is inconsistent with docker_container and not well documented #257

Closed
gotmax23 opened this issue May 13, 2021 · 3 comments · Fixed by #263

Comments

@gotmax23
Copy link
Contributor

gotmax23 commented May 13, 2021

This issue is regarding the container.podman.podman_container module. I discarded the regular bug template because it is not applicable to this issue.

It appears that state: present and state: started do the same thing. In general, the documentation for the state key is unclear.

Additionally, the state key for the community.docker.docker_container module has different options and behavior than podman_container. For example, the docker_container module lacks the state: created option. Instead, on docker_container, state: stopped stops existing containers and also creates new containers without starting them (the role of state: created on podman_container). state: present with docker_container maintains the current state of existing containers and recreates the container if necessary, but with podman_container, it always starts a container, which is the same thing state: started does.

Related: #45

@gotmax23 gotmax23 changed the title ## [Documentation: podman_container] The behavior of the state key is inconsistent with docker_container and not well documented [Documentation: podman_container] The behavior of the state key is inconsistent with docker_container and not well documented May 13, 2021
@sshnaidm
Copy link
Member

OK, let's put things in order:

Docker choices:

absent
present
stopped
started - default

Podman choices:

- absent
- present -> alias to started
- stopped
- started - default
- created
  • absent does the same in all.
  • present in docker Asserts the existence of a container matching the name and any provided configuration parameters. which checks idempotency and recreates in case it's needed.
    present in podman does the same, but ensures containers is started and its alias is started. In docker it ensures container is created (if didn't exist) and does NOT start it. So actually dockers present is acting as created in podman.
    We can change alias in podman from present -> started to present -> created and it should be same as in docker.
  • started behaves same in docker in podman
  • stopped - if no containers, it acts as created/present, if container exists it stops it. and it's exactly as in podman.

So what's required if I understand correctly, is changing 'present -> started' in podman to 'present -> created'.
@gotmax23 what do you think?

sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue May 24, 2021
For being more compliant with docker module.
See containers#257
@sshnaidm sshnaidm linked a pull request May 24, 2021 that will close this issue
@gotmax23
Copy link
Contributor Author

gotmax23 commented May 24, 2021

@sshnaidm Yes, I think that makes sense.

I think it is also necessary to change the documentation to state that state: present is just an alias to state: created (or vice-versa). It's confusing to have seperate descriptions for two options that do the same thing.

For good measure, I think the docs should clarify that state: created (and its new alias) will not stop an existing container matching the config parameters if it's already started.

Thanks!

@sshnaidm
Copy link
Member

Yeah, makes sense.

openstack-mirroring pushed a commit to openstack-archive/tripleo-ansible that referenced this issue May 27, 2021
Use 'network' instead of 'net' alias.
Use state 'started' to ensure container is started[1]

[1] containers/ansible-podman-collections#257
Change-Id: I4b949d44b7cb84500ab51575f60cac084479e820
openstack-mirroring pushed a commit to openstack/openstack that referenced this issue May 27, 2021
* Update tripleo-ansible from branch 'master'
  to 41bc0cc4bc5ab177c792bbdcb4efd51d54b941e7
  - Merge "Correct values for podman container"
  - Correct values for podman container
    
    Use 'network' instead of 'net' alias.
    Use state 'started' to ensure container is started[1]
    
    [1] containers/ansible-podman-collections#257
    Change-Id: I4b949d44b7cb84500ab51575f60cac084479e820
openstack-mirroring pushed a commit to openstack-archive/tripleo-ansible that referenced this issue Jun 1, 2021
Use 'network' instead of 'net' alias.
Use state 'started' to ensure container is started[1]

[1] containers/ansible-podman-collections#257
Change-Id: I4b949d44b7cb84500ab51575f60cac084479e820
(cherry picked from commit 990cca0)
openstack-mirroring pushed a commit to openstack-archive/tripleo-ansible that referenced this issue Jun 1, 2021
Use 'network' instead of 'net' alias.
Use state 'started' to ensure container is started[1]

[1] containers/ansible-podman-collections#257
Change-Id: I4b949d44b7cb84500ab51575f60cac084479e820
(cherry picked from commit 990cca0)
openstack-mirroring pushed a commit to openstack-archive/tripleo-ansible that referenced this issue Jun 1, 2021
Use 'network' instead of 'net' alias.
Use state 'started' to ensure container is started[1]

[1] containers/ansible-podman-collections#257
Change-Id: I4b949d44b7cb84500ab51575f60cac084479e820
(cherry picked from commit 990cca0)
openstack-mirroring pushed a commit to openstack-archive/tripleo-ansible that referenced this issue Jun 2, 2021
Use 'network' instead of 'net' alias.
Use state 'started' to ensure container is started[1]

[1] containers/ansible-podman-collections#257
Change-Id: I4b949d44b7cb84500ab51575f60cac084479e820
(cherry picked from commit 990cca0)
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 6, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 6, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit to sshnaidm/ansible-podman-collections that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See containers#257
sshnaidm added a commit that referenced this issue Jul 7, 2021
For being more compliant with docker module.
See #257
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants