Is it possible to start a shell session in a running container (without ssh)

后端 未结 15 1153
滥情空心
滥情空心 2020-11-29 14:33

I was naively expecting this command to run a bash shell in a running container :

docker run \"id of running container\" /bin/bash

it look

15条回答
  •  独厮守ぢ
    2020-11-29 15:03

    EDIT: Now you can use docker exec -it "id of running container" bash (doc)

    Previously, the answer to this question was:

    If you really must and you are in a debug environment, you can do this: sudo lxc-attach -n Note that the id needs to be the full one (docker ps -notrunc).

    However, I strongly recommend against this.

    notice: -notrunc is deprecated, it will be replaced by --no-trunc soon.

提交回复
热议问题