Experimental
This feature is experimental and may change in future releases.
Info
Sugar's podman-ext extension includes both standard Podman commands and experimental features like attach
, cp
, ls
, scale
, and watch
that won't work currently in container operations.
Sugar provides support for Podman Compose through the podman-ext
extension.
This extension allows you to use Podman as a container engine backend instead of
Docker.
Podman is a daemonless container engine for developing, managing, and running
OCI containers on your Linux system. The podman-ext
extension in Sugar
provides a seamless interface to work with Podman Compose, similar to how you
would use Docker Compose.
To use the podman-ext
extension, you need to have the following installed:
- Podman (latest version recommended)
- podman-compose
You can install podman-compose using pip:
pip install podman-compose
The configuration for Podman extension is the same as for Docker Compose. You
need to specify the backend, groups, and other parameters in the .sugar.yaml
file:
backend: podman
defaults:
group: development
groups:
development:
project-name: my-project
config-path:
- containers/compose.yaml
env-file: .env
services:
default:
- app
- database
available:
- name: app
- name: database
- name: redis
The podman-ext
extension provides the same set of commands as the Docker
Compose extension. Here are the available commands:
sugar podman-ext build
: Build or rebuild servicessugar podman-ext config
: Parse, resolve and render compose file in canonical formatsugar podman-ext create
: Create servicessugar podman-ext down
: Stop and remove containers, networkssugar podman-ext exec
: Execute a command in a running containersugar podman-ext images
: List images used by the created containerssugar podman-ext kill
: Kill containerssugar podman-ext logs
: View output from containerssugar podman-ext pause
: Pause servicessugar podman-ext ps
: List containerssugar podman-ext pull
: Pull service imagessugar podman-ext push
: Push service imagessugar podman-ext restart
: Restart servicessugar podman-ext rm
: Remove stopped containerssugar podman-ext run
: Run a one-off command on a servicesugar podman-ext start
: Start servicessugar podman-ext stop
: Stop servicessugar podman-ext top
: Display running processessugar podman-ext unpause
: Unpause servicessugar podman-ext up
: Create and start containerssugar podman-ext version
: Show the podman-compose version information
sugar podman-ext attach
: Attach to a service's containersugar podman-ext cp
: Copy files/folders between a container and the local filesystemsugar podman-ext ls
: List containerssugar podman-ext scale
: Scale servicessugar podman-ext wait
: Block until the first service container stopssugar podman-ext watch
: Watch build context for service source code changes and rebuild/refresh containers
You can use the podman-ext
extension just like you would use the standard
Docker Compose commands with Sugar. Here are some examples:
# Build default services defined in the configuration
sugar podman-ext build
# Build all services, ignoring defaults
sugar podman-ext build --all
# Build specific services
sugar podman-ext build --services app,database
# Start default services
sugar podman-ext start
# Start all services in detached mode
sugar podman-ext start --all --options -d
# Start specific services in detached mode
sugar podman-ext start --services app,database --options -d
# Execute a command in a running service container
sugar podman-ext exec --service app --cmd "python manage.py migrate"
# Get a shell in a running service container
sugar podman-ext exec --service database --cmd "bash"
Like the Docker Compose extension, the Podman extension supports the use of
environment variables specified in the env-file
parameter:
groups:
development:
env-file: .env
# Other configuration...
While Sugar aims to provide a consistent interface for both Docker Compose and Podman Compose, there are some differences to be aware of:
- Podman Compose uses
-f
instead of--file
for specifying compose files (handled automatically by Sugar) - Podman Compose uses
-p
instead of--project-name
for specifying project names (handled automatically by Sugar) - Podman Compose doesn't directly support the
--env-file
flag, so Sugar loads the environment variables before executing commands
!!! note Note
1. There is no such flag `-d` present in `--options` for
`sugar podman-ext start`.
2. Experimental commands like `attach`, `cp`, `ls`, `scale`, and `watch` may have
different behavior between Podman versions. These commands are not supported currently in Sugar
3. The `wait` command is still in development.
If you encounter issues with the Podman extension:
- Make sure Podman and podman-compose are properly installed and accessible in your PATH
- Check that your
.sugar.yaml
configuration is correctly set up - Run commands with the
--verbose
flag to see detailed output - If a command fails, check the error message for clues about what went wrong
For more advanced troubleshooting, you can also directly use podman-compose commands to verify functionality outside of Sugar.