mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 07:08:01 +00:00
Add SSH Into A Docker Container as a devops til
This commit is contained in:
@@ -9,7 +9,7 @@ and pairing with smart people at Hashrocket.
|
|||||||
|
|
||||||
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
|
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
|
||||||
|
|
||||||
_951 TILs and counting..._
|
_952 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -137,6 +137,7 @@ _951 TILs and counting..._
|
|||||||
- [Reload The nginx Configuration](devops/reload-the-nginx-configuration.md)
|
- [Reload The nginx Configuration](devops/reload-the-nginx-configuration.md)
|
||||||
- [Resolve The Public IP Of A URL](devops/resolve-the-public-ip-of-a-url.md)
|
- [Resolve The Public IP Of A URL](devops/resolve-the-public-ip-of-a-url.md)
|
||||||
- [Running Out Of inode Space](devops/running-out-of-inode-space.md)
|
- [Running Out Of inode Space](devops/running-out-of-inode-space.md)
|
||||||
|
- [SSH Into A Docker Container](devops/ssh-into-a-docker-container.md)
|
||||||
- [SSL Certificates Can Cover Multiple Domains](devops/ssl-certificates-can-cover-multiple-domains.md)
|
- [SSL Certificates Can Cover Multiple Domains](devops/ssl-certificates-can-cover-multiple-domains.md)
|
||||||
- [Wipe A Heroku Postgres Database](devops/wipe-a-heroku-postgres-database.md)
|
- [Wipe A Heroku Postgres Database](devops/wipe-a-heroku-postgres-database.md)
|
||||||
|
|
||||||
|
|||||||
27
devops/ssh-into-a-docker-container.md
Normal file
27
devops/ssh-into-a-docker-container.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# SSH Into A Docker Container
|
||||||
|
|
||||||
|
Before you can SSH into a Docker container, you need to know the name of the
|
||||||
|
container.
|
||||||
|
|
||||||
|
Run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker ps
|
||||||
|
```
|
||||||
|
|
||||||
|
to list the currently running containers and find the name of the one you want
|
||||||
|
to connect to. If you don't see the one you are looking for, it may not be
|
||||||
|
running.
|
||||||
|
|
||||||
|
Then, you can connect to it by name with a bash session like so:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker exec -it <container name> /bin/bash
|
||||||
|
```
|
||||||
|
|
||||||
|
The
|
||||||
|
[`-it`](http://docs.docker.oeynet.com/engine/reference/commandline/container_exec/)
|
||||||
|
flags open an interactive emulated terminal connection. `/bin/bash` is the
|
||||||
|
command that gets run in that context.
|
||||||
|
|
||||||
|
[source](https://phase2.github.io/devtools/common-tasks/ssh-into-a-container/)
|
||||||
Reference in New Issue
Block a user