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.

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:

  1. The required executable file “uvicorn” is not installed in the container’s environment.
  2. The executable file “uvicorn” is not added to the container’s PATH environment variable.
  3. 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:

  1. Check if the “uvicorn” executable is installed in the container’s environment:
  2. docker exec -it <container_name> which uvicorn

    If the command does not return a valid path, it means that “uvicorn” is not installed.

  3. Install “uvicorn” in the container:
  4. 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.

  5. If “uvicorn” is already installed, check if it is added to the container’s PATH environment variable:
  6. 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.

  7. If the above steps do not resolve the issue, try restarting the Docker daemon or restarting the host machine.

By following these steps, you should be able to resolve the “uvicorn: executable file not found in $path” error and start your container successfully.

Read more

Leave a comment