Skip to navigationSkip to main contentSkip to footerScaleway DocsAsk our AI
Ask our AI

How to build and push a container image

This page explains how to create a simple Dockerfile to containerize your applications for deployment using Scaleway Serverless Containers.

Before you start

To complete the actions presented below, you must have:

How to create a Dockerfile

  1. In a new folder, create a file named Dockerfile.

  2. Add the following content to your Dockerfile, adjusting the base image and commands according to your application:

How to build and push your image from your Dockerfile

  1. Open a terminal and navigate to the directory containing your Dockerfile.

  2. Run the following command to build your Docker image:

    docker build -t my-application .
    Note

    Make sure to add the --platform linux/amd64 argument if you build your image on an ARM64 machine, as Serverless Containers only handle amd64 images.

  3. Run the command below to log in to your Scaleway account in the terminal. Make sure that you replace the placeholder values with your own:

    docker login rg.fr-par.scw.cloud/your-container-registry-namespace -u nologin --password-stdin <<< "$SCW_SECRET_KEY"
  4. Tag your Docker image so it matches your Scaleway registry's format:

    docker tag my-application:latest rg.fr-par.scw.cloud/your-container-registry-namespace/my-application:latest
  5. Push the Docker image to the Scaleway Container Registry:

    docker push rg.fr-par.scw.cloud/your-container-registry-namespace/my-application:latest

You can now access your container image from the Scaleway Container Registry, and deploy a Serverless Container from this image.

Tip

You can build, tag and push your image to your Container Registry in a single command using the following syntax:

docker build \
  --platform linux/amd64 \
  --push \
  -t your-container-registry-endpoint/my-application:latest .
Still need help?

Create a support ticket
No Results