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.

Metadata

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 Provenance Actions
ssh-docker-1.2.2.tar.gz 6.6 kB Without provenance Details for ssh-docker-1.2.2.tar.gz

Built distribution (wheel)

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

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

Security for ssh-docker 1.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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