Answers: <p>It looks like you hit <a href="https://github.com/containers/podman-compose/issues/977" rel="nofollow noreferrer">this bug</a>:</p>
  <blockquote>
  <p>1.1.0 (and perhaps above) broke the use of Containerfiles #977</p>
  </blockquote>
  <p>You can rename (or symlink) your <code>Containerfile</code> to <code>Dockerfile</code>, or add a <code>dockerfile: Containerfile</code> attribute to your <code>build</code> directive:</p>
  <pre><code>services:
    app:
      build:
        context: .
        dockerfile: Containerfile
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2024-06-26T13:38:22.050Z
Answers: I have added `dockerfile: Containerfile` attribute, but still the same. And yes, it looks like the bug and it seems someone suggested the fix as well. I hope it will get merged and released soon.
Answers: Tony Montana
Answers: CC BY-SA 4.0
Answers: 2024-06-26T13:41:13.283Z
Answers: Using `dockerfile: Containerfile` works just fine; I tried it before posting the answer. I suspect you may have an error in your compose file.
Answers: larsks
Answers: CC BY-SA 4.0
Answers: 2024-06-26T15:02:15.817Z
Answers: Ok, if that's the case then I am not sure why I am seeing the same error. I mean I should see some different error if there is an issue with my compose or Containerfile.
Answers: Tony Montana
Answers: CC BY-SA 4.0
Answers: 2024-06-26T15:08:36.860Z
Answers: Here's an example of a successful build: https://asciinema.org/a/GOfJxu1cGJMSpdkbRIrKXXXei
Answers: larsks
Answers: CC BY-SA 4.0
Answers: 2024-06-26T19:11:01.367Z
Answers: Yeah. I don't know what I missed but I deleted the compose file completed, build new one using your example and then it worked like a charm! Thank you very much!
Answers: Tony Montana
Answers: CC BY-SA 4.0
Answers: 2024-06-26T13:27:04.450Z
Answers: 2024-06-26T13:27:04.450Z
Answers: larsks
Body: <p>I am using podman-compose with container-compose.yml file to build my containers which contains application and database container.</p>
  <p>This is my container-compose.yml file looks like:</p>
  <pre><code>version: &quot;3&quot;
  services:
    app:
      build: .
      ports:
        - &quot;5001:5001&quot;
      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:
  </code></pre>
  <p>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 <code>OSError: Dockerfile not found in /home/ubuntu/Project/learn_fastapi/Containerfile</code></p>
  <p>This is the full error traceback:</p>
  <pre><code>(env) root@DESKTOP-S11P8K7:/home/ubuntu/Project/learn_fastapi★
  # podman-compose build
  Traceback (most recent call last):
    File &quot;/home/ubuntu/Project/learn_fastapi/env/bin/podman-compose&quot;, line 8, in &lt;module&gt;
      sys.exit(main())
               ^^^^^^
    File &quot;/home/ubuntu/Project/learn_fastapi/env/lib/python3.12/site-packages/podman_compose.py&quot;, line 3309, in main
      asyncio.run(async_main())
    File &quot;/usr/lib/python3.12/asyncio/runners.py&quot;, line 194, in run
      return runner.run(main)
             ^^^^^^^^^^^^^^^^
    File &quot;/usr/lib/python3.12/asyncio/runners.py&quot;, line 118, in run
      return self._loop.run_until_complete(task)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File &quot;/usr/lib/python3.12/asyncio/base_events.py&quot;, line 687, in run_until_complete
      return future.result()
             ^^^^^^^^^^^^^^^
    File &quot;/home/ubuntu/Project/learn_fastapi/env/lib/python3.12/site-packages/podman_compose.py&quot;, line 3305, in async_main
      await podman_compose.run()
    File &quot;/home/ubuntu/Project/learn_fastapi/env/lib/python3.12/site-packages/podman_compose.py&quot;, line 1635, in run
      retcode = await cmd(self, args)
                ^^^^^^^^^^^^^^^^^^^^^
    File &quot;/home/ubuntu/Project/learn_fastapi/env/lib/python3.12/site-packages/podman_compose.py&quot;, line 2272, in compose_build
      s = await t
          ^^^^^^^
    File &quot;/usr/lib/python3.12/asyncio/tasks.py&quot;, line 631, in _wait_for_one
      return f.result()  # May raise f.exception().
             ^^^^^^^^^^
    File &quot;/home/ubuntu/Project/learn_fastapi/env/lib/python3.12/site-packages/podman_compose.py&quot;, line 2225, in build_one
      raise OSError(&quot;Dockerfile not found in &quot; + ctx)
  OSError: Dockerfile not found in /home/ubuntu/Project/learn_fastapi/Containerfile
  </code></pre>
  <p>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.</p>
  <p>This are the details about the <code>podman</code> and <code>podman-compose</code>:</p>
  <pre><code>podman-compose version 1.1.0
  podman version 4.9.3
  </code></pre>
  <p>If anyone can direct in correct direction, I will be very glad. Thank you.</p>
  
Tags: <podman>
Title: Using Containerfile inside podman-compose.yml with podman-compose not working
UserDisplayName: Tony Montana
ThreadText: # Using Containerfile inside podman-compose.yml with podman-compose not working
  
  (Asked by: username_0 on 2024-06-26)
  
  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.
  
  **Tags:** podman
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-06-26. Score: 1 | Accepted answer
  
  It looks like you hit [this bug](https://github.com/containers/podman-compose/issues/977):
  
  > 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
  
  ```
  
  > **Comments:**
  > **username_0**: I have added `dockerfile: Containerfile` attribute, but still the same. And yes, it looks like the bug and it seems someone suggested the fix as well. I hope it will get merged and released soon.  
  > **username_1**: Using `dockerfile: Containerfile` works just fine; I tried it before posting the answer. I suspect you may have an error in your compose file.  
  > **username_0**: Ok, if that's the case then I am not sure why I am seeing the same error. I mean I should see some different error if there is an issue with my compose or Containerfile.  
  > **username_1**: Here's an example of a successful build: https://asciinema.org/a/GOfJxu1cGJMSpdkbRIrKXXXei  
  > **username_0**: Yeah. I don't know what I missed but I deleted the compose file completed, build new one using your example and then it worked like a charm! Thank you very much!  
  
  ---
  
  