Skip to main content

An interactive shell for remotely connecting to docker containers over SSH.

assets/howitworks.gif

This was primarily built to help when dealing with the names given to containers in ECS, but can be used anywhere.

Installation

$ pip install ssh-docker

Usage

$ ssh-docker <hostname>

This will open up an interactive shell (similar to how Supervisor works) allowing you to directly query / perform actions on the containers within the host.

You can then list all containers running on the host via the following:

> list

Connecting to a container is as simple as using the connect command.

> connect

This will list out all of the available containers on the host, which you can then choose to connect to a specific one by entering the number of the container.

If you already know the name of the container you can also specify that in the command.

> connect name_of_container

By default it will attempt to run the bash shell when connecting, you can change this on a per run basis (or globally via the SSH_DOCKER_SHELL environment variable) if required:

> connect name_of_container /bin/ash

Connecting to a container will also print out the ssh command required to connect so you can share it with people who are not running ssh-docker.

Running arbitrary docker commands

You may want to run any of the available Docker commands on the server you’re connected to. You can do this via the docker command:

> docker [command]

Additional Tips

Hostname autocompletion

If the first attempt to connect to a hostname fails, it will attempt to find similar hostnames from your ssh config and suggest them to you.

Autocomplete

If you’d like to enable autocomplete in ZSH, you can add the following to your ~/.zshrc file:

eval "$(_SSH_DOCKER_COMPLETE=source_zsh ssh-docker)"

By entering ssh-docker [TAB] you will be able to cycle through all hostnames in your SSH config file.

Release files for ssh-docker 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ssh-docker 1.2.2
File Size Uploaded
ssh-docker-1.2.2.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ssh-docker 1.2.2
File Interpreter ABI Platform
ssh_docker-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size:16.5 kB

Release files / ssh-docker-1.2.2.tar.gz

Download URL ssh-docker-1.2.2.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
148b0fcc4e8be7f01ad08461c3c93cae09bb1700bb7ac621ffcddc999bc09546
BLAKE2b-256 checksum
How to use checksums
e847dcbf40062f283db7cc8b4e15cb3ce4865eebe81d6c660ddbd244baad2e0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Release files / ssh_docker-1.2.2-py3-none-any.whl

Download URL ssh_docker-1.2.2-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2005fca827a698dcf2299e981897e4660e6f5482907bcf7bdcbc3f441f2944f
BLAKE2b-256 checksum
How to use checksums
e182588a1b8ce928c5900ed60d9b8b53624a10b48a9225e7d7b50dee22e6cc91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page