I have a docker container running
sudo docker ps -a
result:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0cd8d5166717 32bit/ubuntu:14.04 /bin/bash 15 hours ago Up About an hour hadoop-test
How can I bring this running container again to -it mode and grab the terminal of ubuntu system ?
Typically, commands that run in the foreground should use the --rm flag so that the container is cleaned up after the command has completed. If you are testing a long-running command, typing Ctrl+C will exit out of the container. In order to run a container in the background, use the -d flag.
The simplest way to keep the container running is to pass a command that never ends. We can use never-ending commands in any of the following ways: ENTRYPOINT or CMD directive in the Dockerfile. Overriding ENTRYPOINT or CMD in the docker run command.
To restart an existing container, we'll use the start command with the -a flag to attach to it and the -i flag to make it interactive, followed by either the container ID or name. Be sure to substitute the ID of your container in the command below: docker start -ai 11cc47339ee1.
Enter the docker start command with the Container ID in the command line to resume the Container. Note: This preserves environment variables set during the initial docker run statement.
You can attach it:
docker attach 0cd8d5166717
Type Ctrl-PCtrl-Q to detach it again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With