Skip to main content

Running Your Image

The key difference when compared to predefined applications is the use of the custom keyword when creating a custom resource. The command to do this is as follows:

cgc compute create custom -n my-app -g 1 -gt A100 -c 8 -m 24 -v my-vol -fp /workspace/my-app --image repository/my-image:tag

All flags remain the same with the exception of:

  • -i, --image - repository/my-image:tag. Note that if you're pulling from a public repository, the dockerhub doesn't require the repository name.

Please be careful with the full mount path -fp. By default, CGC will mount to /workspace/my-vol as required by Jupyter Lab.

If you want to check all mount paths currently used in your applications, you can use the following command:

cgc compute list-mounts

Extra flags to consider during the creation of a custom application:

  • --repository-secret - name of the secret used to pull the image from a private repository
  • --node-port-enabled - enable NodePort service for the compute resource in the CGC OnPremise instances (available from client version 1.0.14)
  • -e, --environment - allows passing custom environment variables to the container.
  • -ce, --cgc-env - allows passing custom environment variables to the container that are specific to custom applications or jobs.
  • arguments after -- - will be forwarded to the container (e.g., -- --arg1 value1 --arg2 value2 ...). Common variables:
    • CUSTOM_IMAGE - the custom container image name to run.
    • IMAGE_PULL_SECRET_NAME - the name of the secret used to authenticate and pull the image from a private registry.
    • CUSTOM_COMMAND - the command that will be executed inside the container on start.
    • APP_TOKEN - the app token used to authenticate requests to the running instance.

Startup command​

STDIN is accepted as a startup command. You can use the following command to pass your command to the container:

"echo;" | cgc compute create custom -n test --image ubuntu

Or you can use a file:

cat ./command.bash | cgc compute create custom -n test --image ubuntu

In the example above command.bash is a file with your command.

Example content of the command.bash file:

echo "Hello World"; echo "Hello World";

or

echo 'Hello World';
echo 'Hello World';

Using a Private Repository​

Our platform allows you to create and manage your own secrets, which enable you to pull images from private repositories. To configure access, you must first create a registry secret and then reference it when launching your custom compute instance:

  1. Create a registry secret Create a secret within your namespace using the CGC CLI. This secret will store your registry credentials securely and can be reused for future image pulls.
cgc secret create -r <registry_url> -u <username> -p <password> <secret_name>

The secret will be stored in your namespace and can be reused.

  1. Start a Custom instance with the secret Once the secret is created, use it to launch a custom instance:
cgc compute create custom -n <name> -c <CPU> -m <RAM> --image <registry_url>/<namespace>/<image_name>:<TAG> --repository-secret <secret_name>

Deleting Your Custom App​

Applications based on custom images are treated the same as built-in CGC applications. To delete your app, simply use the following command:

cgc compute delete my-app
# or
cgc rm my-app

Billing​

Custom applications are billed in the same way as all other applications.

caution

Please contact us if your image is larger than 20GB so that we can increase your default quota.