nwpuxhld
nwpuxhld

Reputation: 85

Docker run /bin/bash

When I exec the commmand, it occur this error

docker run -it --entrypoint=/bin/bash ld_mmdet:2.4.0 /bin/bash
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory".

then I inspect the images, and found the cmd is null, like this

 "ContainerConfig": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },

So, is there any solution to resolve this? I have try the methods as follows:

Upvotes: 0

Views: 15882

Answers (1)

Alejandro Galera
Alejandro Galera

Reputation: 3691

First, a good practice is launching docker in detached mode and then access it with docker exec -it, for example.

Second, you need to specify an entrypoint or command that doesn't finish.

All /bin/bash, /bin/sh command finishes unless you add args such as sleep infinity or similar. I recommend you execute tail -F /dev/null and then access docker with your bash or sh.

docker run -d --name mymmdet ld_mmdet:2.4.0 tail -F /dev/null
docker exec -ti mymmdet bash

You can verify after docker run command if your docker is running with docker ps -a, and if it's up, then docker exec.

Upvotes: 2

Related Questions