You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7fb1883
Browse filesBrowse the repository at this point in the historyBrowse files
wrangler containers ssh opens a shell in Containers that use the
durable_object scheduling policy without authorized_keys or OpenSSH.
OpenSSH through a Wrangler ProxyCommand stays the way to reach the
default policy and jurisdictions, and to use port forwarding and SFTP.
title: Open a shell in a container without SSH keys
3
+
description: wrangler containers ssh no longer needs authorized_keys or a local OpenSSH install for Containers that use the durable_object scheduling policy.
4
+
products:
5
+
- containers
6
+
date: 2026-12-01
7
+
---
8
+
9
+
[`wrangler containers ssh`](/workers/wrangler/commands/containers/#containers-ssh) now opens a shell in a running Container without SSH keys. You no longer need to add a public key to `authorized_keys` or install OpenSSH locally. This works for Containers that use the [`durable_object` scheduling policy](/containers/configuration/scheduling-policy/).
10
+
11
+
```sh
12
+
wrangler containers ssh <INSTANCE_ID>
13
+
```
14
+
15
+
To run a command, pass it after `--`. Wrangler allocates a terminal when its standard input and standard output are terminals. It exits with the exit code of the remote command.
16
+
17
+
```sh
18
+
wrangler containers ssh <INSTANCE_ID> -- ls /
19
+
```
20
+
21
+
Port forwarding, SFTP, Containers in a jurisdiction, and Containers that use the `default` scheduling policy still need an [OpenSSH connection](/containers/guides/ssh/#connect-with-openssh) with Wrangler as the `ProxyCommand`.
22
+
23
+
For more information, refer to [SSH](/containers/guides/ssh/).
Copy file name to clipboardExpand all lines: src/content/docs/containers/configuration/scheduling-policy.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -200,7 +200,7 @@ Container instances that use the `durable_object` policy do not participate in a
200
200
201
201
### Configure SSH
202
202
203
-
The `durable_object` policy supports the `ssh` and `authorized_keys` fields. Refer to [SSH](/containers/guides/ssh/).
203
+
You can open a shell in instances that use the `durable_object` policy with `wrangler containers ssh`, without SSH keys. Instances in a jurisdiction need SSH keys. The policy also supports the `ssh` and `authorized_keys` fields. Refer to [SSH](/containers/guides/ssh/).
description: Connect to running container instances with SSH.
4
+
description: Open a shell in running container instances with Wrangler.
5
5
sidebar:
6
6
order: 5
7
7
products:
@@ -10,19 +10,80 @@ products:
10
10
11
11
import { WranglerConfig } from"~/components";
12
12
13
-
Anyone with write access to a Container can SSH into it with Wrangler as long as a matching public key is listed in `authorized_keys`.
13
+
Anyone with write access to a Container can open a shell in it with [`wrangler containers ssh`](/workers/wrangler/commands/containers/#containers-ssh).
14
14
15
-
SSH does not expose a publicly accessible port on the Container. The only way to connect is through Wrangler with [`wrangler containers ssh`](/workers/wrangler/commands/containers/#containers-ssh), which authenticates against your Cloudflare account.
15
+
Containers do not expose a public port for the shell or SSH. The only way to connect is through Wrangler, which authenticates against your Cloudflare account.
16
16
17
-
## Configure SSH
17
+
## Open a shell
18
18
19
-
SSH can be configured in your [Container's configuration](/workers/wrangler/configuration/#containers) with the `ssh` and `authorized_keys` properties. Only the `ssh-ed25519` key type is supported.
19
+
Containers that use the [`durable_object` scheduling policy](/containers/configuration/scheduling-policy/) do not need SSH keys or a local OpenSSH install. For Containers in a [jurisdiction](/containers/concepts/placement/) and for other Containers, refer to [Connect with OpenSSH](#connect-with-openssh).
20
20
21
-
The `ssh.enabled` property only controls whether you can SSH into a Container through Wrangler. It defaults to `true`. Set it to `false` to disable SSH access completely.
21
+
Find the instance ID for your Container by running [`wrangler containers instances`](/workers/wrangler/commands/containers/#containers-instances) or in the [Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/workers/containers).
22
+
The instance must be running.
23
+
Wrangler does not start a stopped Container.
24
+
An open shell does not keep a Container alive.
25
+
26
+
To open the default shell, run:
27
+
28
+
```sh
29
+
wrangler containers ssh <INSTANCE_ID>
30
+
```
31
+
32
+
To run a command instead of the default shell, pass it after `--`:
33
+
34
+
```sh
35
+
wrangler containers ssh <INSTANCE_ID> -- ls -al
36
+
```
37
+
38
+
Wrangler runs the command directly, not through a shell. To use shell syntax, such as pipes, run `sh -c`:
Wrangler allocates a terminal when its standard input and standard output are terminals. Pass `--tty` to always allocate a terminal, or `--no-tty` to never allocate one. Wrangler exits with the exit code of the remote command.
45
+
46
+
If standard input and standard output are both redirected and you do not pass a command, Wrangler acts as an [OpenSSH proxy](#connect-with-openssh). To run a shell with redirected streams, pass a command after `--`, or pass `--tty`.
47
+
48
+
You can pipe data to the command. For example, to copy a file into the Container:
The `ssh.enabled` property in your [Container configuration](/workers/wrangler/configuration/#ssh) controls all access through `wrangler containers ssh`. It defaults to `true`. Set it to `false` to turn off shell and SSH access:
57
+
58
+
<WranglerConfig>
59
+
60
+
```jsonc
61
+
{
62
+
"containers": [
63
+
{
64
+
// other options here...
65
+
"ssh": {
66
+
"enabled":false
67
+
}
68
+
}
69
+
]
70
+
}
71
+
```
72
+
73
+
</WranglerConfig>
74
+
75
+
## Connect with OpenSSH
76
+
77
+
To connect with your local OpenSSH client, use `wrangler containers ssh` as an OpenSSH `ProxyCommand`. You need this connection for:
22
78
23
-
## Connect with Wrangler
79
+
- Containers that use the `default` scheduling policy
80
+
- Containers in a jurisdiction
81
+
- Port forwarding
82
+
- SFTP and other tools that use the SSH protocol, such as VS Code Remote-SSH
24
83
25
-
To SSH into a Container with Wrangler, add an `ssh-ed25519` public key to `authorized_keys` in your Container configuration. The following example shows a basic configuration:
84
+
SFTP also needs an SFTP server in the Container image, such as the `openssh-sftp-server` package on Debian.
85
+
86
+
The OpenSSH connection needs an `ssh-ed25519` public key in `authorized_keys` in your Container configuration. Only the `ssh-ed25519` key type is supported. The following example shows a basic configuration:
26
87
27
88
<WranglerConfig>
28
89
@@ -46,32 +107,18 @@ To SSH into a Container with Wrangler, add an `ssh-ed25519` public key to `autho
46
107
47
108
For more information on configuring SSH, refer to [SSH configuration](/workers/wrangler/configuration/#ssh).
48
109
49
-
Find the instance ID for your Container by running [`wrangler containers instances`](/workers/wrangler/commands/containers/#containers-instances) or in the [Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/workers/containers).
50
-
The instance you want to SSH into must be running.
51
-
SSH will not start a stopped Container, and an active SSH connection alone will not keep a Container alive.
52
-
53
-
Once SSH is configured and the Container is running, open the SSH connection with:
54
-
55
-
```bash
56
-
wrangler containers ssh <INSTANCE_ID>
57
-
```
58
-
59
-
To run a command instead of the default shell, pass it after `--`. For interactive commands, such as `top`, also pass `--tty` to allocate a terminal:
110
+
Once the key is configured and the Container is running, connect with:
60
111
61
-
```bash
62
-
wrangler containers ssh <INSTANCE_ID> --tty -- top
You can use `wrangler containers ssh` as an OpenSSH `ProxyCommand`. This lets your local SSH client connect through Wrangler.
116
+
Wrangler pipes standard input and output to the SSH server in the running Container. You can also pass `--stdio` to force this mode. Add other OpenSSH options as usual. For example, to forward local port `8080` to port `8080` in the Container:
When used this way, Wrangler pipes standard input and output to the SSH server in the running Container. You can also pass `--stdio` to force this mode.
74
-
75
122
## Process visibility
76
123
77
-
Without the [`containers_pid_namespace`](/workers/configuration/compatibility-flags/#use-an-isolated-pid-namespace-for-containers) compatibility flag, all processes inside the VM are visible when you connect to your Container through SSH. This flag is turned on by default for Workers with a [compatibility date](/workers/configuration/compatibility-dates/) of `2026-04-01` or later.
124
+
Without the [`containers_pid_namespace`](/workers/configuration/compatibility-flags/#use-an-isolated-pid-namespace-for-containers) compatibility flag, all processes inside the VM are visible when you connect to your Container. This flag is turned on by default for Workers with a [compatibility date](/workers/configuration/compatibility-dates/) of `2026-04-01` or later.
- The port for the SSH service to run on. Defaults to `22`.
1665
+
- The port for the SSH service to run on. Defaults to `22`. Only [OpenSSH connections](/containers/guides/ssh/#connect-with-openssh) use it.
1666
1666
1667
1667
### Authorized keys
1668
1668
1669
-
An authorized key is a public key that can be used to SSH into a Container.
1669
+
An authorized key is a public key that can be used to [connect to a Container with OpenSSH](/containers/guides/ssh/#connect-with-openssh). A shell opened with `wrangler containers ssh` does not need one.
- Force pseudo-terminal (PTY) allocation. Use this when running an interactive command.
263
+
- Allocate a pseudo-terminal (PTY). By default, Wrangler allocates one when standard input and standard output are terminals. Pass `--no-tty` to never allocate one.
- Proxy SSH traffic over standard input and standard output. Use this to run Wrangler as an OpenSSH `ProxyCommand`. Refer to [Connect with OpenSSH](/containers/guides/ssh/#connect-with-openssh).
0 commit comments