Running command in docker container results in directly shutting down the docker container
0
0
Entering edit mode
16 months ago
stan.aanhane ▴ 30

Im currently struggling to run a container and execute a command within this container.I'm trying to use NanoSNP (https://github.com/huangnengCSU/NanoSNP), which is an image available from dockerhub. After fulling this docker, the following command would be sufficient to run the the container:

docker run \
-v "${INPUT_DIR}":"${INPUT_DIR}" \
-v "${OUTPUT_DIR}":"${OUTPUT_DIR}" \
--gpus all \ huangnengcsu/nanosnp:v2.1-gpu \ run_caller.sh \
-b "${INPUT_DIR}/input.bam" \
-f "${INPUT_DIR}/reference.fa" \
-t "${THREADS}" \
-c "${COVERAGE}" \
-o "${OUTPUT_DIR}"

What i've been using to start the docker is the following:

docker run snp \
huangnengcsu/nanosnp:v2.1-gpu \
    run_caller.sh \
        --bam_fn=/home/stanaanhane/anaconda3/envs/SNPcalling/Code_SNP/BRCA1_MAP.sorted.bam \
            --ref_fn=/home/stanaanhane/anaconda3/envs/SNPcalling/Code_SNP/BRCA1.fasta \
                --output=/home/stanaanhane/anaconda3/envs/SNPcalling/Data \
                    --threads==10 \
                        --coverage==1

But when started, I see the docker container starting, but almost directly stop. The docker ps -a looks like this:

99cd4e272f19   huangnengcsu/nanosnp:v2.1-gpu   "/bin/bash"   19 hours ago   Exited (0) 18 hours ago               snp
446add2244e4   ubuntu                          "bash"        19 hours ago   Exited (137) 18 hours ago             festive_kirch
013d00f65681   hello-world                     "/hello"      23 hours ago   Exited (0) 23 hours ago               upbeat_cannon
78481d30f8a0   hello-world                     "/hello"      23 hours ago   Exited (0) 23 hours ago               loving_mclean
1aba1e8fa496   hello-world                     "/hello"      23 hours ago   Exited (0) 23 hours ago               admiring_visvesvaraya

I've tried looking around, but can't find the solution. If anyone has a suggestion, please let me know.

Thanks!

docker-container python ubuntu docker • 1.4k views
ADD COMMENT
0
Entering edit mode

Looks like this requires a GPU to work. Do you have one available on your machine and is it configured for use with docker?

ADD REPLY
0
Entering edit mode

GenoMax I do have an RTX 3050 ti (notebook). But when adding the -- gpus all command above huangnengcsu/nanosnp:v2.1-gpu \, it shows the following error code:

docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]]. ERRO[0000] error waiting for container: context canceled

I tried installing the linux GPU driver, but bash shows its not compatible. Im using WSL btw.

ADD REPLY
0
Entering edit mode

This is pretty tricky (trying to use GPU with docker under WSL). I am not a docker expert but it sounds like you will need to do some configuration on docker side to use this

https://stackoverflow.com/questions/70761192/docker-compose-equivalent-of-docker-run-gpu-all-option

ADD REPLY
0
Entering edit mode

It seems like the problem is either one of the two following problems:

  1. I cant use sudo apt-get install nvidia-docker2, it will give me the following error: Unable to locate package nvidia-docker2

The solution (with the needed repository) has migrated on the Nvidia website, so I haven't been able to locate that.

  1. When running nvidia -smi it shows the following:

    +-----------------------------------------------------------------------------+ | NVIDIA-SMI 525.85.05 Driver Version: 528.24 CUDA Version: 12.0 | |-------------------------------+----------------------+----------------------+ | 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 ... On | 00000000:01:00.0 Off | N/A | | N/A 49C P8 10W / 45W | 220MiB / 4096MiB | 5% Default | | | | N/A | +-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | 0 N/A N/A 27 G /Xwayland N/A | +-----------------------------------------------------------------------------+

This suggests that the GPU is recognised, but when running the benchmark

sudo docker run --rm --gpus all nvidia/cuda:11.6.2-base-ubuntu20.04 nvidia-smi

it shows the following error:

docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]].

so its either that my GPU is not detected or not compatible (RTX 3050 ti notebook).

ADD REPLY

Login before adding your answer.

Traffic: 2010 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6