Deployment Shell Access
Abilities to manage deployed Akash containers have been accentuated greatly within this release. Introduced deployment capabilities include:
  • Ability to execute commands within running Linux containers/Akash deployments. Such an ability resembles “docker exec” command execution within a live container instance.
  • Ability to gain access to the CLI/shell of a running Linux container/Akash deployment.
  • Ability to remote copy files from running Linux containers/Akash deployments to a local file instance for inspection.
In the subsections which follow granular details of these introduced features will be explored with example executions and depictions.

Remote Shell Command Execution

Execute command sets within a running Akash deployment
  • Command template with variable bracketing as such <variable-name>
  • Notes of interest pertaining to command execution:
    • The service-name variable must match the service value in the deployment’s SDL. For example - in the depicted segment of an SDL file below - the service-name in remote shell execution would be “web”
1
akash provider lease-shell --from <key-name> --dseq <dseq-number> --provider=<provider-address> <service-name> <command-to-execute>
Copied!
  • Example command fully populated
    1
    akash provider lease-shell --from mykey --dseq 226186 --provider=akash1gx4aevud37w4d6kfd5szgp87lmkqvumaz57yww web cat /etc/passwd
    Copied!
  • Example command fully populated using environment variables
  • Prior establishment of the AKASH_KEY_NAME and AKASH_PROVIDER environment variables would be necessary to allow this syntax
1
akash provider lease-shell --from $AKASH_KEY_NAME --dseq 226186 --provider=$AKASH_PROVIDER web cat /etc/passwd
Copied!
  • Expected output example

Access the Deployment Shell (CLI)

Gain access to an active Akash deployment’s CLI/shell
  • Command template with variable bracketing as such <variable-name>
  • Command notes of interest:
    • The service-name variable must match the service value in the deployment’s SDL. For example - in the depicted segment of an SDL file below - the service-name in remote shell execution would be “web”
    • Note the “tty” switch dictating desire for shell/CLI access
1
akash provider lease-shell --from <key-name> --dseq <dseq-number> --tty --provider=<provider-address> <service-name> /bin/sh
Copied!
  • Example command fully populated
    • Note - the container instance must have a /bin/sh shell for the command to work in this exact syntax. If this were an Alpine container base image /bin/sh would need to become /bin/ash and this serves as an example of possible edit to the command syntax based on container type.
    1
    akash provider lease-shell --from mykey --dseq 226186 --tty --provider=akash1gx4aevud37w4d6kfd5szgp87lmkqvumaz57yww web /bin/sh
    Copied!
    • Example command fully populated using environment variables
    • Prior establishment of the AKASH_KEY_NAME and AKASH_PROVIDER environment variables would be necessary to allow this syntax
    1
    akash provider lease-shell --from $AKASH_KEY_NAME --dseq 226186 --tty --provider=$AKASH_PROVIDER web /bin/sh
    Copied!
  • Expected output example
  • Note - Linux commands “pwd” and “ls” are included and as executed within the deployment to validate Akash container shell access

Copy File from Akash Container/Deployment

Copy a file from an active Akash deployment to a local file instance for inspection
  • Command template with variable bracketing as such <variable-name>
  • Command notes of interest:
    • The service-name variable must match the service value in the deployment’s SDL. For example - in the depicted segment of an SDL file below - the service-name in remote shell execution would be “web”
1
akash provider lease-shell --from <key-name> --dseq <dseq-number> --provider=<provider-address> <service-name> <command-to-execute> > <local-file-name>
Copied!
  • Example command fully populated
1
akash provider lease-shell --from mykey --dseq 226186 --provider=akash1gx4aevud37w4d6kfd5szgp87lmkqvumaz57yww web cat /etc/passwd > local_copy_of_passwd
Copied!
  • Example command fully populated using environment variables
  • Prior establishment of the AKASH_KEY_NAME and AKASH_PROVIDER environment variables would be necessary to allow this syntax
1
akash provider lease-shell --from $AKASH_KEY_NAME --dseq 226186 --provider=$AKASH_PROVIDER web cat /etc/passwd > local_copy_of_passwd
Copied!
  • Expected output example
  • Note - Linux command “ls” and “cat” are included in the depiction to validate successful file copy from remote Akash container/deployment to local file

SDL Example Utilized

Full SDL code samples used throughout this guide
1
---
2
version: "2.0"
3
services:
4
web:
5
image: pengbai/docker-supermario
6
expose:
7
- port: 8080
8
as: 80
9
to:
10
- global: true
11
http_options:
12
max_body_size: 3145728
13
read_timeout: 50000
14
send_timeout: 51000
15
next_cases: ["error", "500"]
16
next_tries: 2
17
accept:
18
- supermariotest.akash.network
19
profiles:
20
compute:
21
web:
22
resources:
23
cpu:
24
units: 0.1
25
memory:
26
size: 512Mi
27
storage:
28
size: 512Mi
29
placement:
30
westcoast:
31
signedBy:
32
anyOf:
33
- "akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63"
34
pricing:
35
web:
36
denom: uakt
37
amount: 3000
38
deployment:
39
web:
40
westcoast:
41
profile: web
42
count: 1
Copied!