Overview
You can use this document to learn how to enable remote access and then connect to a container.
- To learn how to enable remote access and connect to a virtual machine, see Enable Remote Access and Connect to a Virtual Machine.
After you enable remote access for a workload, all instances (containers and virtual machines) within the workload will have remote access enabled. For containers, you can connect via a container console.
Step 1: Enable remote access for a container
You can use these instructions to enable remote access for a virtual machine or for a container.
- In the StackPath Control Portal, in the left-side navigation, click Edge Compute.
- In the left-side navigation menu, click Workloads.
- Locate and select the desired workload.
- Navigate to Manage Your Instances, and then use the slider to enable Remote Management.
- Above Manage Your Instances, navigate to Instances, and then select the desired instance.
- You will be redirected to the detailed screen for the selected instance.
- Navigate to Remote Management, and then review the on-screen instructions.
- You can use the populated command to connect to your container and execute commands.
- For additional connection information, see Step 2: Connect to a container.
Step 2: Connect to a container
After you enable remote access for a container, you can:
- Use the container console as an interactive shell to run commands, or
- For each connection to container console, a new process starts and commands are executed, similar to Docker Exec.
- Execute commands over an SSH connection to your container.
Unlike virtual machine access, no user is required on the container to remotely connect to a StackPath container.
Option 1: Connect to an interactive shell
A container's interactive shell creates a process with a bash shell and interprets the output through a simulated terminal driver.
- To understand how to populate the command, review the following table:
Variable Description -p 9600 Changes the port for SSH from 22 to 9600 -t Creates a psuedo-TTY, a terminal-like interface for interaction with your live container /bin/bash Opens a bash shell on the container in a new process <stack-id> Stack ID or Stack Slug can be used here. Stack ID can be found in the URL ../stack/<stack_id>in the portal. Stack Slug can be found on your list of Stacks in the portal. <instance-name> The hostname of your instance <container-name> "container-0" <portal-username> The email address used to login to control.stackpath.com - Based on your instance and account details, run the following command in a command line interface on a local computer:
ssh -p 9600 -t <stack-id>.<instance-name>.<container-name>.<portal-username>@container-console.edgeengine.io /bin/bash
- When prompted, enter your StackPath account password.
- A successful login will result in a bash interface.
Option 2: Execute a command
- To understand how to populate the command, review the following table:
Variable Description -p 9600 Changes the port for SSH from 22 to 9600 <your_command> Any unix statement that will execute on your container. <stack-id> Stack ID or Stack Slug can be used here. Stack ID can be found in the URL ../stack/<stack_id>in the portal. Stack Slug can be found on your list of Stacks in the portal. <instance-name> The hostname of your instance <container-name> "container-0" <portal-username> The email address used to login to control.stackpath.com - To execute a command remotely on your container, run the following command in a command line interface on a local computer. You must populate the command with your own account and container information.
ssh -p 9600 <stack-id>.<instance-name>.<container-name>.<portal-username>@container-console.edgeengine.io <your_command>
- When directed, enter your StackPath account password.
- A successful login will result in execution on the container and the output of the command sent to your terminal.