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

feat: Add support for 'podman-compose' in sugar #167

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

sanjay7178
Copy link
Contributor

@sanjay7178 sanjay7178 commented Mar 11, 2025

This PR implements support for podman-compose commands in Sugar, expanding its capabilities beyond Docker Compose.

Solve #166

How to test these changes

poetry install 
sugar podman-ext --help 

This PR is a:

  • new feature

environment :

podman-compose version 1.3.0
podman version 3.4.4

Reference :

PR Checklist:

  • Add unit tests for swarm functionality (tests/unit/extensions/test_podman_ext.py)
  • Add smoke tests for podman_ext commands in .makim.yaml
  • Updated core.py to integrate the podman-ext (podman-compose) extension
  • Added proper documentation for all commands.
  • Add podman-compose pypi package to poetry

Sugar Podman-Ext CLI Specific Checklist :

  • attach Attach to a service.
  • build Build or rebuild services.
  • config Parse, resolve and render compose file in canonical format.
  • cp Copy files/folders between a service container.
  • create Create services.
  • down Stop and remove containers, networks.
  • events Receive real time events from containers.
  • exec Execute a command in a running container.
  • images List images used by the created containers.
  • kill Kill containers.
  • logs View output from containers.
    - [ ] ls List running compose projects.
  • pause Pause services.
  • port Print the public port for a port binding.
  • ps List containers.
  • pull Pull service images.
  • push Push service images.
  • restart Restart services.
  • rm Remove stopped containers.
  • run Run a one-off command on a service.
  • scale Scale services.
  • start Start services.
  • stop Stop services.
    - [ ] top Display the running processes.
  • unpause Unpause services.
  • up Create and start containers.
  • version Show the podman-compose version information.
  • wait Block until the first service container stops.
  • watch Watch build context for service source code changes and.

Observation from podman-compose and docker-compose :

  • Podman-compose ps doesn't support service names as arguments
  • top command does'nt work in podman-compose , so stats is used instead in podman-compose
  • podman-compose doesn't accept service names as arguments for the config command.
  • podman compose ls is hard to integrate , it doesnt seems to be run

@xmnlab
Copy link
Member

xmnlab commented Mar 13, 2025

@sanjay7178 , do we really need to have a new extension for podman? or could we just add support to it with backend and change the current compose and compose-ext to work with both?

@sanjay7178
Copy link
Contributor Author

@sanjay7178 , do we really need to have a new extension for podman? or could we just add support to it with backend and change the current compose and compose-ext to work with both?

Actually I found out few interesting things that really required the podman as seperate command in sugar

  1. If docker sock and podman sock both were running at same time as mentioned in this pr sugar podman-ext can used to run especially on podman sock
  2. for point 1. if we can achieve doing that we can run sugar config as daemonless and rootless containers
  3. When I tried implementing this pr , I found a issue ie .. while a running a podman-compose to run compose file it requires the absolute path , not relative path . Otherwise it throws file doesnt exists error (Screenshot attached below)
  4. from point 3. while i tried podman compose command to run as well with same flags , it looks for docker daemon sock (I see this error would especially comes with podman and docker socks running at same time)
  5. On comparing podman compose or podman-compose and docker-compose I seen more few arguments/features are lacking such as ignore orphaned containers , experimental docker commands such as alpha , disabling helper menu ,compatibility mode

image
image

conclusion :

  • for point 2 and 3 I've made working proof of concept
  • so making podman-ext as separate command would be beneficial and we can have a feature to export sugar config files to kubernetes manifests which runs on a podman pod .

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 this pull request may close these issues.

2 participants