0

I am using podman-compose with container-compose.yml file to build my containers which contains application and database container.

This is my container-compose.yml file looks like:

version: "3"
services:
  app:
    build: .
    ports:
      - "5001:5001"
    depends_on:
      - db
    environment:
      - DATABASE_URL=postgres://postgres:1234@db:5432/ApplicationYT
  db:
    image: postgres
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=1234
      - POSTGRES_DB=ApplicationYT
    volumes:
      - db-data:/var/lib/postgresql/data
volumes:
  db-data:

And I have Containerfile in the same path of container-compose.yml file. But when I am trying to use podman-compose to build it, I am getting error OSError: Dockerfile not found in /home/ubuntu/Project/learn_fastapi/Containerfile

This is the full error traceback:

(env) root@DESKTOP-S11P8K7:/home/ubuntu/Project/learn_fastapi★
# podman-compose build
Traceback (most recent call last):
  File "/home/ubuntu/Project/learn_fastapi/env/bin/podman-compose", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/ubuntu/Project/learn_fastapi/env/lib/python3.12/site-packages/podman_compose.py", line 3309, in main
    asyncio.run(async_main())
  File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/ubuntu/Project/learn_fastapi/env/lib/python3.12/site-packages/podman_compose.py", line 3305, in async_main
    await podman_compose.run()
  File "/home/ubuntu/Project/learn_fastapi/env/lib/python3.12/site-packages/podman_compose.py", line 1635, in run
    retcode = await cmd(self, args)
              ^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/Project/learn_fastapi/env/lib/python3.12/site-packages/podman_compose.py", line 2272, in compose_build
    s = await t
        ^^^^^^^
  File "/usr/lib/python3.12/asyncio/tasks.py", line 631, in _wait_for_one
    return f.result()  # May raise f.exception().
           ^^^^^^^^^^
  File "/home/ubuntu/Project/learn_fastapi/env/lib/python3.12/site-packages/podman_compose.py", line 2225, in build_one
    raise OSError("Dockerfile not found in " + ctx)
OSError: Dockerfile not found in /home/ubuntu/Project/learn_fastapi/Containerfile

It looks like I may have missed something but I have tried to find the resources on how to use Containerfile instead of Dockerfile but I could not find it. And I can use Dockerfile but I don't want to, I just want to continue to podman specific naming conventions.

This are the details about the podman and podman-compose:

podman-compose version 1.1.0
podman version 4.9.3

If anyone can direct in correct direction, I will be very glad. Thank you.

Tony Montana
  • 103
  • 2

1 Answers1

1

It looks like you hit this bug:

1.1.0 (and perhaps above) broke the use of Containerfiles #977

You can rename (or symlink) your Containerfile to Dockerfile, or add a dockerfile: Containerfile attribute to your build directive:

services:
  app:
    build:
      context: .
      dockerfile: Containerfile
larsks
  • 823
  • 5
  • 8