Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker: Error response from daemon: failed to create shim

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
like image 339
Talha Anwar Avatar asked Sep 14 '25 00:09

Talha Anwar


1 Answers

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
like image 122
BMitch Avatar answered Sep 15 '25 12:09

BMitch