The example specified in the adjacent response will work to enter the working container and start an additional process, but will not do anything with the process stopped, as described in the task.
docker run -ti --name test-subject ubuntu root@6d7a294a9450:/# exit --- docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 6d7a294a9450 ubuntu "/bin/bash" 2 minutes ago Exited (0) About a minute ago test-subject --- docker exec -ti test-subject bash Error response from daemon: Container 6d7a294a9450b81420c8cf25357a580c3f05f25fae5bc03e890d9b5737c1b266 is not running
In order to enter a stopped one, you must first start it.
docker start test-subject
In this particular case, the container will be released immediately, because its main process is bash, which cannot read STDIN and has not received a command, and in this case it is of interest to cling to the main process rather than launch another process in the container. Therefore, it is necessary to directly indicate the docker, that it is necessary to hook STDIN to the process that will be started via start:
docker start -ia test-subject root@6d7a294a9450:/#
voila