Repository: mlcommons/inference
Issue: Docker container not found
Root cause: Validation Gap

Hi, I am running Bert benchmark with the docker version
```
cm run script --tags=run-mlperf,inference,_find-performance,_full,_r4.1-dev \
   --model=bert-99 \
   --implementation=nvidia \
   --framework=tensorrt \
   --category=datacenter \
   --scenario=Offline \
   --execution_mode=test \
   --device=cuda  \
   --docker --quiet \
   --test_query_count=500
```

Here are the specs of system:
- OS: Ubuntu 24.04.1 LTS
- CPU: Intel I7-14700
- GPU: NVIDIA A6000

Which results in the following error message:
```
INFO:root:* cm run script "run docker container"

Checking existing Docker container:

  docker ps --filter "ancestor=local/mlperf-inference-nvidia-v4.1-dev-common:nvcr.io-nvidia-mlperf-mlperf-inference-mlpinf-v4.0-cuda12.2-cudnn8.9-x8664-ubuntu20.04-public-latest"  2> /dev/null


CM error: Docker is either not installed or not started:
Command 'docker ps --filter "ancestor=local/mlperf-inference-nvidia-v4.1-dev-common:nvcr.io-nvidia-mlperf-mlperf-inference-mlpinf-v4.0-cuda12.2-cudnn8.9-x8664-ubuntu20.04-public-latest"  2> /dev/null' returned non-zero exit status 1.!
```

The docker is installed and the versions are as follows:
```
$ docker -v
Docker version 26.1.3, build 26.1.3-0ubuntu1~24.04.1
$ docker-compose -v
docker-compose version 1.29.2, build unknown
```

It seems to be a missing docker image to me. Will the command automatically pull the image and run it? Could anyone give me some suggestions on how to solve this issue? Thank you.

The command is expected to build the docker image locally. Even if the image is missing, the below command is not expected to return an error. Can you please share the output of the below command?

```
docker ps --filter "ancestor=local/mlperf-inference-nvidia-v4.1-dev-common:nvcr.io-nvidia-mlperf-mlperf-inference-mlpinf-v4.0-cuda12.2-cudnn8.9-x8664-ubuntu20.04-public-latest"  

```

Here is the output
```
docker ps --filter "ancestor=local/mlperf-inference-nvidia-v4.1-dev-common:nvcr.io-nvidia-mlperf-mlperf-inference-mlpinf-v4.0-cuda12.2-cudnn8.9-x8664-ubuntu20.04-public-latest"
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.45/containers/json?filters=%7B%22ancestor%22%3A%7B%22local%2Fmlperf-inference-nvidia-v4.1-dev-common%3Anvcr.io-nvidia-mlperf-mlperf-inference-mlpinf-v4.0-cuda12.2-cudnn8.9-x8664-ubuntu20.04-public-latest%22%3Atrue%7D%7D": dial unix /var/run/docker.sock: connect: permission denied
```

Thank you @Xi0131 for sharing. The issue is with permission to run docker. The below command should fix this - but after running the command you'll need to restart the shell. 

```
sudo usermod -aG docker $USER
```

@anandhu-eng Is it possible to add this "permission" check inside CM docker run?

The benchmark is running!
Thank you for your assistance! Appreciate it!

Some details about implementing the suggested fix
```
# set permission
sudo usermod -aG docker $USER
# restart docker
sudo systemctl restart docker
# restart group permission
newgrp docker
## finally enter the venv again and run the benchmark
```