DEV Community

Pheak Pheasa
Pheak Pheasa

Posted on

Docker exec container.

docker exec -it <container-id> bash

Here's a breakdown of the command:

  • docker: This is the command-line tool used to interact with Docker.
  • exec: This subcommand is used to execute a command in a running container.
  • -it: These are flags used together to allocate a pseudo-TTY (terminal) and keep STDIN open even if not attached. This allows you to interact with the shell.
  • 8256ec84091703b9da993d13830dc8dc79d7d09117381a9a50b09b792f7f3e85: This is the example ID of the Docker container you want to execute the command in.
  • bash: This is the command to execute within the container. In this case, it's starting an interactive Bash shell session.

Top comments (0)