Podman Compose: --userns and --pod Conflict and Missing Containers

Hi everyone,

I’m trying to bring up a multi-container application using podman compose on NixOS, but I’m encountering some errors. Here’s what’s happening:

1. Successful Container Creation

Some containers are being created successfully, as indicated by their IDs:

e3cd360b3f49ad885aea87e41e3b52df37fce9c97f90b44a268ae0e08cc98c54 
efab06bf3c5200ed7c0f4bcaa0a8b954e9f606490d425624229facfbb0f72362 cosfunding_pgsql 
17d68cf887aed248af83b1a03a9e38b26dbdf03cb9b6cc0a4cb6d6971273ddf4 cosfunding_redis 
da3d17e5b96c88941708e0e531564c9412c7a90a0532d5c0023c83fc062f2bd5 cosfunding_minio 
5304a93339279c0323df9ef30ed5f2d1ed61537eb025935194a2f53f9b69df06 cosfunding_soketi 
d88058eeb9d6b47a688f2d39ec296863d9b94594dbc875b4eddd31408f02cd60 cosfunding_mailpit

2. Errors with --userns and --pod

For some containers, I’m getting the following error:

Error: --userns and --pod cannot be set together

This seems to be preventing the creation of cosfunding_worker and cosfunding_app.

3. Missing Containers

The following containers are not being found:

Error: no container with name or ID “cosfunding_worker” found: no such container
Error: no container with name or ID “cosfunding_app” found: no such container
Error: “cosfunding_app” is not a valid container, cannot be used as a dependency: no container with name or ID “cosfunding_app” found: no such container
Error: no container with name or ID “cosfunding_nginx” found: no such container

What I’ve Tried So Far

  • Running podman compose down to clean up existing containers and pods.
  • Checking the compose.yml file to ensure all services are defined correctly.

Questions

  1. How can I resolve the --userns and --pod conflict in podman compose?
  2. Why are some containers (cosfunding_worker, cosfunding_app, cosfunding_nginx) not being found or created?
  3. Are there any specific configurations or workarounds for using podman compose with NixOS?

Any help or guidance would be greatly appreciated!

And below there is my compose.yml.

Compose.yml
services:
  worker:
    build:
      context: .
      dockerfile: Containerfile
    container_name: cosfunding_worker
    userns_mode: "keep-id"
    working_dir: /app
    volumes:
      - .:/app:z
    networks:
      - cosfunding
    depends_on:
      - pgsql
      - redis
    command: php artisan queue:listen --tries=3 --sleep=3
    env_file:
      - .env
    healthcheck:
      test: [ "CMD", "php", "artisan", "queue:restart" ]
      interval: 30s
      timeout: 10s
      retries: 3

  app:
    build:
      context: .
      dockerfile: Containerfile
    container_name: cosfunding_app
    userns_mode: "keep-id"
    working_dir: /app
    volumes:
      - .:/app:z
    networks:
      - cosfunding
    depends_on:
      - pgsql
      - redis
      - minio
      - soketi
      - mailpit
    env_file:
      - .env
    healthcheck:
      test: ["CMD", "php", "-v"]
      interval: 30s
      timeout: 10s
      retries: 5

  nginx:
    image: bitnami/nginx:latest
    container_name: cosfunding_nginx
    working_dir: /app
    ports:
      - "8000:8080"
    volumes:
      - .:/app:z
      - ./container/nginx/nginx.conf:/opt/bitnami/nginx/conf/server_blocks/cosfunding.conf:ro
    networks:
      - cosfunding
    depends_on:
      - app
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost"]
      interval: 30s
      timeout: 10s
      retries: 5

  pgsql:
    image: postgres:17
    container_name: cosfunding_pgsql
    ports:
      - "5433:5432"
    environment:
      POSTGRES_DB: cosfunding
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: password
    env_file:
      - .env
    volumes:
      - pgsql_data:/var/lib/postgresql/data
    networks:
      - cosfunding
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "${DB_USERNAME}", "-d", "${DB_DATABASE}"]
      interval: 30s
      timeout: 10s
      retries: 5

  redis:
    image: redis:alpine
    container_name: cosfunding_redis
    networks:
      - cosfunding
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 30s
      timeout: 10s
      retries: 5

  minio:
    image: minio/minio:latest
    container_name: cosfunding_minio
    environment:
      MINIO_ROOT_USER: CTjucuftfxR1YkfXgRvH
      MINIO_ROOT_PASSWORD: x8YIKodJo25mCBoMSwGNqOKzYe1ud3eHMBIWALWX
    command: "server /data --console-address ':9001'"
    ports:
      - "9000:9000"
      - "9001:9001"
    volumes:
      - minio_data:/data:z
    networks:
      - cosfunding
    env_file:
      - .env
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
      interval: 30s
      timeout: 10s
      retries: 5

  soketi:
    image: quay.io/soketi/soketi:latest-16-alpine
    container_name: cosfunding_soketi
    environment:
      SOKETI_DEBUG: '1'
      SOKETI_METRICS_SERVER_PORT: '9601'
      SOKETI_DEFAULT_APP_ID: ${PUSHER_APP_ID}
      SOKETI_DEFAULT_APP_KEY: ${PUSHER_APP_KEY}
      SOKETI_DEFAULT_APP_SECRET: ${PUSHER_APP_SECRET}
      SOKETI_DEFAULT_APP_CLUSTER: 'mt1'
    ports:
      - "6001:6001"
      - "9601:9601"
    networks:
      - cosfunding
    env_file:
      - .env
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:6001"]
      interval: 30s
      timeout: 10s
      retries: 5

  mailpit:
    image: axllent/mailpit:latest
    container_name: cosfunding_mailpit
    ports:
      - "1025:1025"
      - "8025:8025"
    networks:
      - cosfunding
    env_file:
      - .env
    healthcheck:
      test: [ "CMD", "curl", "-f", "http://localhost:8025" ]
      interval: 30s
      timeout: 10s
      retries: 5

volumes:
  pgsql_data:
  minio_data:

networks:
  cosfunding:
    driver: bridge

Thanks in advance!