NavigationContentFooter
Jump toSuggest an edit

How to create and deploy a container with the Scaleway CLI

Reviewed on 19 February 2024Published on 18 August 2021

Scaleway Command Line Interface Overview

The Scaleway Command Line Interface (CLI) allows you to pilot your Scaleway infrastructure directly from your terminal, providing a faster way to administer and monitor your resources. Scaleway CLI is easy to set up and use, and an essential tool for operating efficiently in your cloud environment. The CLI provides many functionalities, including the ability to create and deploy Serverless Containers.

Security & Identity (IAM)

To perform certain actions described below, you must either be the Owner of the Organization in which the actions will be performed or an IAM user with the necessary permissions.

Requirements
  • You have an account and are logged into the Scaleway console
  • You have configured your SSH key
  • You have generated your API key
  • You have downloaded and installed the Scaleway CLI

Configuring the CLI

  1. Open a terminal and type the following command to configure the Scaleway CLI on your machine:

    scw init

    If you have already configured the CLI, you will see a message like the following:

    Current config is located at /path/to/config.yaml
    access_key: your-access-key
    secret_key: your-secret-key
    default_organization_id: ID-of-your-organization
    default_project_id: ID-of-your-project
    default_region: your-default-region (fr-par)
    default_zone: your-default-zone (fr-par-1)
    Do you want to override the current config? (Y/n):
  2. Type n and go directly to the Creating a container step of this procedure if you do not want to edit your configuration.

    If you have not yet configured the CLI, you will be guided through the configuration process via a series of questions:

    Enter a valid secret-key or an email
  3. Enter either the email address for your account (you will then be asked for your password), or your API secret key:

    To improve this tool we rely on diagnostic and usage data.
    Sending such data is optional and can be disabled at any time by running "scw config set send-telemetry=false".
    Do you want to send usage statistics and diagnostics? (Y/n):

    Type y or n.

    To fully enjoy Scaleway CLI we recommend you install autocomplete support in your shell.
    Do you want to install autocomplete? (Y/n):

    Type y or n.

    To enable autocomplete, scw needs to update your shell configuration.
    What type of shell are you using (default: zsh):
  4. Press enter if the default shell type displayed is the one you are using. Otherwise, enter the correct shell type you are using. This should complete the configuration process:

    Initialization completed with success.

Creating a container

  1. Run the following command in your terminal to create a containers namespace:

    scw container namespace create name=<YOUR_NAMESPACE_NAME>

    An output similar to the following displays:

    ID 6e74dbb7-9323-46bb-abc7-5c0105f4e70e
    Name <YOUR_NAMESPACE_NAME>
    OrganizationID 55e28409-776f-4f65-a41e-6c5fc58b4076
    ProjectID 55e28409-776f-4f65-a41e-6c5fc58b4076
    Status pending
    RegistryNamespaceID -
    RegistryEndpoint -
    Description -
    Region fr-par
  2. Run the following command in your terminal to create a container:

    scw container container create name=<CONTAINER_NAME> namespace-id=<NAMESPACE_ID> registry-image=<IMAGE_REGISTRY_URL>

    An output similar to the following displays:

    ID 717fb5f9-95c3-4c0b-84db-2321283e46dc
    Name <CONTAINER_NAME>
    NamespaceID cee31af8-d43e-4078-8f55-c921a9311f47
    Status created
    MinScale 0
    MaxScale 5
    Runtime python310
    MemoryLimit 256
    CPULimit 140
    Timeout 5 minutes
    Handler handler.handle
    Privacy public
    Description -
    DomainName namespace0leshy-cli-fn-containername.containers.fnc.fr-par.scw.cloud
    Region fr-par
    HTTPOption enabled
    RuntimeMessage -
    Note

    For testing purposes, you can use the registry-image=nginx:latest and port=80 parameters to quickly create a container.

Deploying a container

  1. Run the following command to deploy your container with the zip archive you just created:

    scw container container deploy <CONTAINER_ID>

    The deployment process can take several minutes, depending on the image used.

  2. Run the following command to call your container:

    curl <YOUR_CONTAINER_ENDPOINT>

    Your container is now deployed and ready to be used.

Cloud Products & Resources
  • Scaleway Console
  • Compute
  • Storage
  • Network
  • IoT
  • AI
Dedicated Products & Resources
  • Dedibox Console
  • Dedibox Servers
  • Network
  • Web Hosting
Scaleway
  • Scaleway.com
  • Blog
  • Careers
  • Scaleway Learning
Follow us
FacebookTwitterSlackInstagramLinkedin
ContractsLegal NoticePrivacy PolicyCookie PolicyDocumentation license
© 1999-2024 – Scaleway SAS