Did you know you can SSH into a Docker container that is running? This short tutorial demonstrates how this can be done.
How to SSH into a Container?
First and foremost, using the command docker exec you can get into a docker container like the following:
$ docker exec -it <my container name> /bin/bash
Execute Specify command
$ docker exec -it <my container name> <command>
Use the docker ps command to find the container name you want to ssh into.
Here are two of my favorite Docker Books in case you want to learn more about it.
- Docker: Up & Running: Shipping Reliable Containers in Production by Sean P. Kane
- Docker in Action 2nd Edition by Jeff Nickoloff