I have a rather simple docker-compose file (One Mongo Service, one test service):
version: "3.7"
services:
mongo:
image: docker.io/mongo:4.4
container_name: mongo
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=example
test:
build:
context: ./..
dockerfile: ./tests/Dockerfile
image: antarctic_test
volumes:
- ./../tests/:/project/tests:ro
- ./../xxx/:/project/xxx:ro
depends_on:
- mongo
command: >
poetry run pytest
# should I kill mongo service explicitly here. If so, how?
As part of our CI/CD process I would like to run this with podman-compose. This actually works(!) with
poetry run podman-compose run -d mongo
poetry run podman-compose run test
podman pod rm -f tests
But that's bad. I shouldn't be forced to start the mongo service explicitly before I enter the test service. It's also not how modern docker-compose works. I think a better approach would be
poetry run podman-compose up test
poetry run podman-compose down
However, in this case it executes the tests and then hangs forcing me to shutdown the mongo service with Ctrl C explicitly. This is somewhat disappointing. Even more so, as this construction works beautifully with docker-compose.
I guess the short answer could be that I shouldn't rely on podman-compose but I would like to understand better what's going on. Maybe I do something stupid in the docker-compose.yml. Please tell me