SSH is the Swiss Amy Knife of system administration and provides the easiest way to manage a system remotely. When running containers, there is typically someway to connect to a container’s shell from a client that communicates through an API like Docker or by using an SSH solution which is how Apcera does it. Some applications that run in containers may require SSH access to communicate with other containers or services. For example, Hadoop is a popular cluster application that uses a distributed filesystem spread across many nodes and communicates with each other via SSH. Let’s take a look on how to setup an SSH server running inside a capsule (a minimal OS container) on the Apcera Platform.
1. Create a capsule.
2. Connect to the capsule so it can be configured.
3. Run the following commands inside the capsule.
I had to change the port that the SSH server listens on because Apcera uses the default port 22 to provide access to the capsule with their command-line utility APC. Please note that once SSH is installed in a capsule, you will not be able to use “apc app connect” any longer.
4. Expose the SSH port so a external route can be added.
5. Add a route to the application for external access.
Now it is time to add an external route so I can remotely login the capsule with SSH. On Apcera, traffic goes through the central host which contains the router for the entire platform. I need to know the IP address of the central host so I can add the route. If you are using Apcera Community Edition, this can be acquired by running:
The port I am connecting to is 55540 which is a random free port on the system. When I use SSH to login remotely, I will need to specify the port.
6. Connect to the SSH server using the public routing port.
I hope that you found this blog useful on how to install SSH into a capsule on Apcera. The same capsule configuration instructions from step 3 can be used in your Dockerfile if you wanted to run Docker images on the platform. If you have time, check out the Apcera Community edition that can be installed on your laptop or in the cloud for free: