buildah - unable to find the Python executable set in PATH

450 views Asked by At

I am trying to build a basic image and execute the container for Python Django web application. I have executed the below steps but when i try to run the container it throws an error message stating python3.8 executable not found. Could you please let me know if i am missing anything here. As when i try to check within the container i can see they python executable present

[root@fed32 ~]# buildah from fedora
[root@fed32 ~]# buildah run fedora-working-container -- dnf -y install python3.8
[root@fed32 ~]# buildah run fedora-working-container -- dnf -y install pip
[root@fed32 ~]# buildah run fedora-working-container -- pip install Django
[root@fed32 ~]# buildah run fedora-working-container -- mkdir -p /home/admin/Django_Projects
[root@fed32 ~]# buildah config --workingdir /home/admin/Django_Projects fedora-working-container
[root@fed32 ~]# buildah run fedora-working-container -- django-admin startproject mysite
[root@fed32 ~]# buildah config --workingdir /home/admin/Django_Projects/mysite fedora-working-container
[root@fed32 ~]# buildah config --env PATH=$PATH:/usr/bin/python3.8 fedora-working-container
[root@fed32 ~]# buildah config --cmd '["/usr/bin/python3.8", "manage.py", "runserver"]' fedora-working-container
[root@fed32 ~]# buildah config --port 8000 fedora-working-container
[root@fed32 ~]# buildah commit fedora-working-container hellodjango

Error - 
[root@fed32 ~]# podman run -dt -p 8000:8000 localhost/hellodjango
Error: executable file `[/usr/bin/python3.8,` not found in $PATH: No such file or directory: OCI runtime command not found error

[root@fed32 ~]# buildah run fedora-working-container -- /bin/bash
[root@f283758d9ad2 Django_Projects]# 
[root@f283758d9ad2 Django_Projects]# whereis python3.8
python3: /usr/bin/python3.8 /usr/bin/python3 /usr/lib/python3.8 /usr/lib64/python3.8 /usr/local/lib/python3.8 /usr/include/python3.8
[root@f283758d9ad2 Django_Projects]# ls -ltr /usr/bin/python3.8
-rwxr-xr-x. 1 root root 15536 Aug 13 11:53 /usr/bin/python3.8
[root@f283758d9ad2 Django_Projects]# echo $PATH
/root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/bin/python3.8


1

There are 1 answers

0
sb9 On

There was a syntax issue on how to pass cmd parameters. I was able to resolve the issue by modifying my cmd as below.

Before -

[root@fed32 ~]# buildah config --cmd '["/usr/bin/python3.8", "manage.py", "runserver"]' fedora-working-container

After -

[root@fed32 ~]# buildah config --cmd '"/usr/bin/python3.8" "manage.py" "runserver"' fedora-working-container