Answer:
When encountering the error message “docker: error response from daemon: failed to create task for container: failed to create shim task: oci runtime create failed: runc create failed: unable to start container process: exec: "uvicorn": executable file not found in $path: unknown“, it means that the Docker runtime is unable to locate the executable file “uvicorn” required to start the container process.
This error can occur due to a few potential reasons:
- The required executable file “uvicorn” is not installed in the container’s environment.
- The executable file “uvicorn” is not added to the container’s PATH environment variable.
- There might be an issue with the container’s runtime configuration or the Docker engine itself.
To resolve this error, you can take the following steps:
- Check if the “uvicorn” executable is installed in the container’s environment:
- Install “uvicorn” in the container:
- If “uvicorn” is already installed, check if it is added to the container’s PATH environment variable:
- If the above steps do not resolve the issue, try restarting the Docker daemon or restarting the host machine.
docker exec -it <container_name> which uvicorn
If the command does not return a valid path, it means that “uvicorn” is not installed.
docker exec -it <container_name> apt-get update
docker exec -it <container_name> apt-get install -y uvicorn
Replace <container_name> with the actual name or ID of your container.
docker exec -it <container_name> echo $PATH
The output should include the path where “uvicorn” is installed. If not, you need to add it to the PATH variable inside the container.
docker exec -it <container_name> export PATH=$PATH:/path/to/uvicorn
Replace “/path/to/uvicorn” with the actual path where “uvicorn” is installed.
By following these steps, you should be able to resolve the “uvicorn: executable file not found in $path” error and start your container successfully.