docker: Error response from daemon: failed to create shim
17,990
This command is incorrectly ordered:
sudo docker run test --gpus all
The docker run command takes the syntax:
docker ${args_to_docker} run ${args_to_run} image_name ${cmd_override}
The --gpus
is a flag to the run
command, and not a command you want to run inside your container. So you'd reorder as:
sudo docker run --gpus all test
Related videos on Youtube
Author by
Talha Anwar
Updated on June 04, 2022Comments
-
Talha Anwar almost 2 years
On a fresh ubunto i installed docker and when i run the image, i got following error
docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "--gpus": executable file not found in $PATH: unknown. ERRO[0000] error waiting for container: context canceled
This is how i make system ready
sudo apt updat sudo apt full-upgrade sudo apt autoremove
#install gpu drivers via software and updates
sudo apt install nvidia-cuda-toolkit sudo apt install docker.io
#here is docker file
FROM python:3 WORKDIR /workspace COPY test.py /workspace RUN pip install torch==1.7.1+cu101 torchvision==0.8.2+cu101 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html CMD ["python", "./test.py"]
#here is test.py file
import torch print('testing') print(torch.cuda.get_device_name(0)) print(torch.cuda.is_available()) print(torch.cuda.current_device()) print(torch.cuda.device_count()) print('gpu')
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2019 NVIDIA Corporation Built on Sun_Jul_28_19:07:16_PDT_2019 Cuda compilation tools, release 10.1, V10.1.243
nvidia-smi
-----------------------------------------------------------------------------+ | NVIDIA-SMI 470.57.02 Driver Version: 470.57.02 CUDA Version: 11.4 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 NVIDIA GeForce ... Off | 00000000:01:00.0 On | N/A | | N/A 64C P0 24W / N/A | 513MiB / 6069MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+
uname -r 5.8.0-63-generic
lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.2 LTS Release: 20.04 Codename: focal
docker version Client: lient: Version: 20.10.2 API version: 1.41 Go version: go1.13.8 Git commit: 20.10.2-0ubuntu1~20.04.3 Built: Fri Jul 23 21:06:26 2021 OS/Arch: linux/amd64 Context: default Experimental: true Server: Engine: Version: 20.10.2 API version: 1.41 (minimum version 1.12) Go version: go1.13.8 Git commit: 20.10.2-0ubuntu1~20.04.3 Built: Fri Jul 23 19:35:35 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.5.2-0ubuntu1~20.04.2 GitCommit: runc: Version: 1.0.0~rc95-0ubuntu1~20.04.2 GitCommit: docker-init: Version: 0.19.0 GitCommit:
This is how i build image and run it
sudo docker build -t test . sudo docker run test --gpus all
-
BMitch almost 3 yearsThe
docker version
command didn't provide any server output at all? -
Talha Anwar almost 3 yearsit provides and i updated the post
-
-
Talha Anwar almost 3 yearsthanks alot. i have spent hours on this. thanks once again.
-
Talha Anwar almost 3 yearsi have one more question, like if my
test.py
accept two argument i,o which i can run in python aspython test.py -i inp -o out
, how can i do it in docker. I trieddocker run --gpus all test -i inp -o out
but its not picking -
BMitch almost 3 yearsWhen you override the cmd, you replace it completely, so you'd need to
docker run --gpus all test python test.py -i inp -o out