Containers – SSH into running Container instances

You can now SSH into running Container instances using Wrangler. This is useful for debugging, inspecting running processes, or executing one-off commands inside a Container.

To connect, enable wrangler_ssh in your Container configuration and add your ssh-ed25519 public key to authorized_keys:

  • wrangler.jsonc

    {
    "containers": [
    {
    "wrangler_ssh": {
    "enabled": true
    },
    "authorized_keys": [
    {
    "name": "<NAME>",
    "public_key": "<YOUR_PUBLIC_KEY_HERE>"
    }
    ]
    }
    ]
    }
  • wrangler.toml

    [[containers]]
    [containers.wrangler_ssh]
    enabled = true
    [[containers.authorized_keys]]
    name = "<NAME>"
    public_key = "<YOUR_PUBLIC_KEY_HERE>"

Then connect with:

wrangler containers ssh <INSTANCE_ID>

You can also run a single command without opening an interactive shell:

wrangler containers ssh <INSTANCE_ID> -- ls -al

Use wrangler containers instances <APPLICATION> to find the instance ID for a running Container.

For more information, refer to the SSH documentation.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *