Docker: Execute Commands inside a Running Container
To access the terminal of a running container, you can use the following command:
docker exec -it <container name> sh
docker exec -it <container ID> sh
You can also replace sh with bash.
Note: To exit the container without stopping or killing it, you can press Ctrl + P + Q
You can see the names and IDs of your running contains by performing the command below:
- How to Check Docker Desktop and Docker Engine Versions
- Using Docker Compose 3 with Node.js and MongoDB
- Limit resources consumed by Docker Desktop
- Using Docker Compose to speed up WordPress development
- Docker build with custom Dockerfile name
You can also check out our Docker topic page for the latest tutorials, examples, tips, and tricks.
View all comments