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

Enable usage of --ansi never argument to be support docker-compose based CLI syntax #1077

Open
nilsjha opened this issue Nov 27, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@nilsjha
Copy link

nilsjha commented Nov 27, 2024

Libraries like Spring Boot have implementations for docker-compose CLI, which breaks when using podman-compose as a direct drop-in replacement. By drop-in, I've symlinked docker-compose to podman-compose . The library here (Spring) references the --ansi argument, which is present in docker-compose, but not in podman-compose.

See https://github.com/spring-projects/spring-boot/blob/74d69d0eb150d5f17e3715f225eb4f5809df9202/spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/core/DockerCli.java#L100

If having the support to specify --ansi never as an alternative to --no-ansi, the utilities will be more cross-compatible.

2024-11-27T20:27:15.988+01:00 ERROR 73685 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.boot.docker.compose.core.ProcessExitException: 'docker compose --file /home/<project-dir>/compose.yaml --ansi never config --format=json' failed with exit code 2.

Stdout:
Stderr:
>>>> Executing external compose provider "/usr/local/bin/docker-compose". Please see podman-compose(1) for how to disable this message. <<<<

usage: docker-compose [-h] [-v] [--in-pod in_pod] [--pod-args pod_args]
                      [--env-file env_file] [-f file] [--profile profile]
                      [-p PROJECT_NAME] [--podman-path PODMAN_PATH]
                      [--podman-args args] [--podman-pull-args args]
                      [--podman-push-args args] [--podman-build-args args]
                      [--podman-inspect-args args] [--podman-run-args args]
                      [--podman-start-args args] [--podman-stop-args args]
                      [--podman-rm-args args] [--podman-volume-args args]
                      [--no-ansi] [--no-cleanup] [--dry-run]
                      [--parallel PARALLEL] [--verbose]
                      {help,version,wait,systemd,pull,push,build,up,down,ps,run,exec,start,stop,restart,logs,config,port,pause,unpause,kill,stats,images}
                      ...
docker-compose: error: argument command: invalid choice: 'never' (choose from help, version, wait, systemd, pull, push, build, up, down, ps, run, exec, start, stop, restart, logs, config, port, pause, unpause, kill, stats, images)
Error: executing /usr/local/bin/docker-compose --file /home/<project-dir>/compose.yaml --ansi never config --format=json: exit status 2
@nilsjha nilsjha added the enhancement New feature or request label Nov 27, 2024
@gwallet
Copy link

gwallet commented Dec 4, 2024

Hi,

Spring Boot Docker Compose rely on the latest version of docker-compose that introduce a lot of new options

As a workaround, one can install the latest version of docker-compose (2.x)

podman compose command can delegate calls to docker-compose and spring-boot-docker-compose works like a charm.

Both podman-compose and docker-compose can be installed, podman compose can be driven to choose the one we want via environment variable (PODMAN_COMPOSE_PROVIDER) or via config file (containers.conf)

More info there:

$ man 2 podman-compose
$ man 5 containers.conf

Hope it helps,
P.S.: It worked for me 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants