A Home Assistant custom component that monitors and controls Docker containers on remote hosts over SSH. All communication with the remote host is performed through the ssh_command integration, which must be installed as a dependency.
- π³ Docker Container Monitoring β Track the state, image, and creation date of containers on remote hosts
- π Auto-Update Detection β Automatically detects when a newer image is available upstream
- π€ Auto-Update β Optionally recreate containers when a newer image is detected
- π HA Update Entities β Containers with available image updates appear natively in Home Assistant's Settings β Updates panel and can be installed from there with one click
- π Automatic Discovery β Discovers all containers on a host and offers to add them to Home Assistant
- ποΈ Full Container Control β Create, start, restart, stop, and remove containers from within Home Assistant
- π Sidebar Panel β Auto-registered dashboard listing all containers grouped by host with filtering
- π΄ Lovelace Card β Individual container card for any Lovelace dashboard
- π‘ SSH Transport β All host communication is delegated to
ssh_command.executeβ no direct SSH dependencies in this integration
SSH Docker works with any Home Assistant installation that supports custom components (Core, Supervised, OS, Container). No specific minimum version is enforced beyond what the underlying ssh_command dependency requires.
The remote host where your containers run must be a Linux system. SSH Docker issues standard Linux shell commands over SSH (e.g. docker inspect, docker ps, docker restart, command -v β¦) and relies on a POSIX shell environment. Non-Linux SSH targets (e.g. native Windows Server, macOS without a Linux VM) are not supported.
Expected to work with:
- Any Linux distribution with a working SSH server (OpenSSH or compatible)
- Docker CE / EE
- Podman (set Docker command to
podmanorsudo podman) - untested - Any other Docker-compatible CLI that accepts the same
ps,inspect,pull,restart,stop, andrmsubcommands
An SSH server (e.g. OpenSSH sshd) must be running and reachable on the remote host. Authentication via password or SSH private key is supported.
This integration depends on the SSH Command integration. It should be automatically installed when installing SSH Docker through HACS or you can install it first manually:
- Click the badge above or search for SSH Docker in HACS
- Click Download
- Restart Home Assistant
- Add the integration via
Settings > Devices & Services > Add Integration
- Ensure SSH Command is already installed
- Download or clone this repository
- Copy the
ssh_dockerfolder to your Home Assistantconfig/custom_componentsdirectory - Restart Home Assistant
- Add the integration via
Settings > Devices & Services > Add Integration
Navigate to Settings > Devices & Services > Add Integration and search for SSH Docker.
Fill in the following fields:
| Field | Required | Description |
|---|---|---|
| Name | β | Friendly display name for this entry (must be unique across all entries) |
| Service | β | Name of the Docker container on the remote host |
| Host | β | Hostname or IP address of the remote server |
| Username | β | SSH username |
| Password | SSH password (use instead of key_file) |
|
| Key file | Path to an SSH private key file on the HA host (use instead of password) |
|
| Check known hosts | β | Verify host key against known hosts (default: true) |
| Known hosts | β | Path or string of the known hosts (only valid when check_known_hosts is true) |
| Docker command | β | The Docker executable on the remote host, e.g. docker, sudo docker, podman (default: docker) |
| Check for updates | β | When enabled, checks for newer upstream images during each sensor update (default: false) |
| Auto update | β | When enabled and an update is detected, automatically recreates the container (requires docker_create; default: false) |
Note: Either
passwordorkey_filemust be provided.
When a new entry is added the integration validates the SSH connection and verifies that the named container exists on the host before creating the entry.
After an entry is created, click the cog icon βοΈ to adjust its settings. All SSH and Docker fields are editable in options.
Note:
NameandServicecannot be changed after the entry is created.
Each configured container creates a sensor entity named sensor.ssh_docker_<name>.
The sensor state reflects the current Docker container state:
| State | Meaning |
|---|---|
running |
Container is running |
exited |
Container has stopped |
created |
Container exists but has never been started |
paused |
Container is paused |
dead |
Container is dead |
unavailable |
Container does not exist or SSH connection failed |
creating |
create service is executing |
restarting |
restart service is executing |
stopping |
stop service is executing |
removing |
remove service is executing |
The sensor is updated every 24 hours by default, or on demand via the Refresh action.
| Attribute | Description |
|---|---|
name |
Friendly display name of the container (language-independent; used by the panel and Lovelace card) |
host |
Remote host the container runs on |
image |
Docker image name |
created |
Container creation timestamp |
update_available |
true when a newer upstream image is available (only set when check_for_updates is enabled) |
docker_create_available |
true when the docker_create executable is present on the remote host |
When Check for updates is enabled for a container entry, SSH Docker also creates an update entity named update.ssh_docker_<name> for each configured container. This entity integrates with Home Assistant's native update mechanism so that pending image updates are surfaced in Settings β Updates alongside other HA and add-on updates.
- After each sensor poll the update entity is automatically refreshed. When a newer upstream image is detected (
update_available: true) the entity state becomes on (update available). - When no update is pending, or the container is unreachable, the entity state is off.
- The update entity is linked to the same device as the container sensor, so both appear together in the device detail page.
Navigate to Settings β Updates in Home Assistant. Containers with a pending image update are listed there. Click the container's update card and then Install to trigger a container recreation using the docker_create executable on the remote host β exactly the same operation as clicking β¬ Update in the sidebar panel.
Requires the
docker_createexecutable to be present on the remote host. See Custom Executables for details.
While the installation is running the entity reports in_progress: true and the update card shows a progress indicator. Once completed the sensor is refreshed automatically to reflect the new container state.
SSH Docker provides the following services in the ssh_docker domain. All services target a container sensor via entity_id.
Creates (or recreates) the Docker container using the docker_create executable on the remote host.
Requires the
docker_createexecutable to be present on the remote host'sPATHor at/usr/bin/docker_create. The executable receives the container name as its sole argument.
The sensor state transitions to creating while the operation runs. Non-zero exit codes from docker_create are treated as warnings (not errors) since cleanup steps in creation scripts often exit non-zero harmlessly. The timeout is 10 minutes.
action: ssh_docker.create
target:
entity_id: sensor.ssh_docker_grocyRestarts the Docker container (also works to start a stopped/exited container). The sensor state transitions to restarting while the operation runs.
action: ssh_docker.restart
target:
entity_id: sensor.ssh_docker_grocyStops the Docker container. The sensor state transitions to stopping while the operation runs.
action: ssh_docker.stop
target:
entity_id: sensor.ssh_docker_grocyStops and removes the Docker container. The sensor state transitions to removing while the operation runs.
action: ssh_docker.remove
target:
entity_id: sensor.ssh_docker_grocyWhen a new entry is successfully added, SSH Docker automatically scans the host for additional Docker containers and offers to add unconfigured ones as new entries. The discovery form is pre-filled with all SSH and Docker settings from the original entry β including the check_for_updates and auto_update values β so the user only needs to confirm the container name.
Discovered container names are automatically capitalized in the Name field (e.g., grocy β Grocy) while the Service field retains the original lowercase name.
Discovery logic:
- If
docker_servicesis present on the remote host'sPATHor at/usr/bin/docker_services, it is called and its output is parsed as a list of container names (JSON array, or names separated by spaces, commas, or newlines). - Otherwise, the integration falls back to listing all containers via
docker ps -a, whose output is also parsed flexibly (any combination of spaces, commas, or newlines).
A SSH Docker entry is automatically added to the Home Assistant sidebar when the integration is installed β no manual dashboard setup required.
The panel shows all containers grouped by host with live filtering:
| Filter | Shows |
|---|---|
| All states | Every container |
| running | Running containers |
| exited | Stopped containers |
| unavailable | Unreachable containers |
| β¬ updates (N) | Containers with a newer image available (shown only when applicable) |
When containers span more than one host, a second filter row appears beneath the state filter. It shows All Hosts plus a button for each individual host. Host and state filters can be combined β for example, selecting running and then myserver shows only running containers on that host.
Each container card displays the current state (color-coded), image, creation date, and an β¬ Update available badge when applicable. Action buttons are shown conditionally:
| Button | Condition |
|---|---|
| β Create | docker_create_available is true and container is unavailable |
| β Recreate | docker_create_available is true, container exists, and no update is pending |
| β¬ Update | docker_create_available is true, container is running, and update_available is true |
| βΆ Start | Container is exited, created, dead, or paused |
| βΊ Restart | Container is running |
| β Stop | Container is running |
| π Remove | Container is not unavailable |
| β» Refresh | Always shown; triggers an immediate sensor update |
The panel is mobile-friendly: on narrow screens a hamburger menu button (β°) appears in the toolbar to open the Home Assistant sidebar.
An individual container card is also available for any Lovelace dashboard:
type: custom:ssh-docker-card
entity: sensor.ssh_docker_grocyThe card displays the container's state, image, creation date, and an β¬ Update available badge when applicable. It includes the same action buttons as the sidebar panel with identical visibility conditions:
| Button | Condition |
|---|---|
| β Create | docker_create_available is true and container is unavailable |
| β Recreate | docker_create_available is true, container exists, and no update is pending |
| β¬ Update | docker_create_available is true, container is running, and update_available is true |
| βΆ Start | Container is exited, created, dead, or paused |
| βΊ Restart | Container is running |
| β Stop | Container is running |
| π Remove | Container is not unavailable |
| β» Refresh | Always shown; triggers an immediate sensor update |
SSH Docker integrates with two optional executables on the remote host:
Required for the create service and auto-update functionality. Place this script on the remote host's PATH or at /usr/bin/docker_create. It receives the container name as the first argument and is responsible for creating (or recreating) the container in whatever way is appropriate for your setup.
Example docker_create script:
#!/bin/bash
set -e
SERVICE=$1
docker compose -f /opt/docker/${SERVICE}/docker-compose.yml up -dOptional. If present on the remote host's PATH or at /usr/bin/docker_services, it is used during discovery to list available containers. Its output is parsed flexibly: a JSON array of strings is preferred, but whitespace-, comma-, or newline-separated names are also accepted.
Example docker_services script:
#!/bin/bash
docker ps -a --format '{{.Names}}' | python3 -c "import sys, json; print(json.dumps(sys.stdin.read().split()))"SSH Docker uses per-host semaphores to cap concurrent SSH connections to a maximum of 3 per host. This prevents overloading the remote SSH server when many containers are configured on the same host, avoiding Connection lost errors that would otherwise occur when many sensors update simultaneously.
When Home Assistant starts, each sensor defers its first SSH update until after the homeassistant_started event.
The check for whether docker_create is present on the remote host is performed once per host per poll cycle (cached for 24 hours). All containers on the same host reuse the cached result, so only one SSH round-trip is made per host regardless of how many containers are configured.
SSH Docker ships with translations for the following languages:
| Language | Code |
|---|---|
| English | en |
| German | de |
Community contributions for additional languages are welcome!
- If you are using HassOS and enable
check_known_hostswithout explicitly providingknown_hosts, this may fail because the default known hosts file may not be accessible from within Home Assistant. Either disable host checking (not recommended) or provideknown_hostsexplicitly. docker_createscripts that run cleanup commands (e.g.docker rm) before creating a container may exit non-zero even on success. SSH Docker logs these as warnings rather than errors; the actual container state is always verified after the operation.
Have ideas or feature requests? I'm open to suggestions!
- π Additional Translations β Community contributions welcome for your language
- π― Your Ideas β Open an issue to suggest new features!
Contributions are welcome! Feel free to:
- π Report bugs via Issues
- π‘ Suggest features
- π Contribute translations
- π Improve documentation
This project is licensed under the terms specified in the MIT License.
If you find SSH Docker useful, please consider giving it a star on GitHub! It helps others discover the project.