Connect to a Running Docker Container Shell
Explore the file system and processes in the container, tail a log file, and more.
When using Docker in your development workflow, it is sometimes necessary to connect to a running Docker container to perform critical tasks or troubleshoot issues. For example, you may want to explore the file system, look at processes running in the container, tail a log file in the container, and more.
You can connect to a running Docker container in many ways: using the docker attach
command, using docker exec
, or (surprise!) with the click of a button in the IDE!
After connecting to Docker, the Services tool window gives you access to all functionality around Docker. You can start/stop containers, explore images, networks, and volumes, inspect a container's environment variables, expose ports, and much more.
After selecting your container in the tree on the left-hand side, clicking Terminal will open a terminal inside the container and lets you work with it interactively. You can now run any command in the Docker container and look at the results.