Manage Host Key Verification
mainBy default, aiodocker enforces strict host key verification. The remote host must be present in your ~/.ssh/known_hosts file.
To add a host key:
- Manually connect:
ssh ubuntu@remote-host - Use keyscan:
ssh-keyscan -H remote-host >> ~/.ssh/known_hosts
To disable verification (Testing only):
Use SSHConnector with strict_host_keys=False. Warning: This is vulnerable to man-in-the-middle attacks.
from aiodocker.ssh import SSHConnector
# WARNING: Only for testing - vulnerable to man-in-the-middle attacks
connector = SSHConnector(
"ssh://ubuntu@test-host:22",
strict_host_keys=False
)
async with aiodocker.Docker(connector=connector) as docker:
containers = await docker.containers.list()