mysqlpodman

podman build throws an Error: no FROM statement found


I have following Dockerfile to build mysql image under /opt/docker/mysql/Dockerfile.

FROM mysql:5.7
...

And here is db.yml file that uses above file under /opt/docker/db.yml.

# mysql/db yaml
version: '3.7'

volumes:
  foodb: {}

services:
  db:
    build:
      context: ./mysql
      network: host
      args:
        - app_dir=foo
    expose:
       - "3306"
    ports:
       - "3306:3306" # For dev debugging
    volumes:
      - "foodb:/var/lib/mysql"

I launched following podman cmd to build its image.

podman build -f ./db.yml

Then it threw Error: no FROM statement found. From my quick research, I ran into a few saying using old podman may cause this error however I have pretty recent podman and podman-compose installed on rhel 8 server.

podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 4.4.1

I have to say I was able to build docker image just fine with docker however once I switched to podman I ran into this problem.

I'd greatly appreciate someone can explain to me what causes this error.


Solution

  • You are running podman build command with compose file. You probably need to run podman-compose build instead.

    You can run either to use the compose file

    podman-compose -f db.yml build
    

    Or you should run build directly using the Dockerfile.

    podman build -f mysql/Dockerfile