Remote Shell

Lagoon allows you to connect to your running containers via SSH. The containers themselves don't actually have an SSH server installed, but instead you connect via SSH to Lagoon, which then itself creates a remote shell connection via the Kubernetes API for you.


Ask your Lagoon administrator for the Lagoon SSH host and port. For, this and 32222.


As you connect via SSH, the authentication also happens automatically via SSH public & private key authentication (passwordless FTW!)


Connecting is straightforward and follows the following pattern:

  • PORT - The remote shell SSH endpoint port (for 32222).

  • HOST - The remote shell SSH endpoint host (for

  • PROJECT-ENVIRONMENT-NAME - The environment you want to connect to. This is most commonly in the pattern PROJECTNAME-ENVIRONMENT.

As an example:

ssh -p 32222 -t [email protected]

This will connect you to the project drupal-example on the environment main.

Pod/Service, Container Definition

By default, the remote shell will try to connect you to the container defined with the type cli. If you like to connect to another pod/service you can define it via:


If your pod/service contains multiple containers, Lagoon will connect you to the first defined container. Or you can define the specific container via:


As example to connect to the php container within the nginx pod:

ssh -p 32222 -t [email protected] service=nginx container=php

Execute Commands

Like with regular SSH, you can also execute a remote command directly without opening an actual shell.


ssh -p 32222 -t [email protected] whoami
ssh -p 32222 -t [email protected] service=nginx whoami
ssh -p 32222 -t [email protected] service=nginx container=php whoami

This will execute whoami within the cli container.

Multiple SSH Keys

If you have multiple SSH keys, you can specify which key to use for a given domain by setting this in your ~/.ssh/config file.


Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/[YOUR-DEFAULT-PRIVATE-KEY]