dockercontainersdevopspodmanbuildah

How to solve buildah run error: container not known?


So I build container using buildah bud:

buildah bud -t ${imageFullName()} -f ${componentName}/DockerfileTests ${buildArgsStr} ${componentName}

But then, when I try to run a command inside this container:

buildah run ${componentName} -- python3 -m pytest src/test_models.py

it returns error reading build container: container not known . How can I solve this issue?


Solution

  • In this case, my first command make an image, not a container. To create a container from this image, i have to run command:

    buildah from ${imageFullName()}
    

    Now, when you've created a container you can look for it's name by using a command which displays all containers that are avalable now:

    buildah containers
    

    And after getting the name of the container you can successfully run:

    buildah run ${containerName} -- ...your command...