NavigationContentFooter
Jump toSuggest an edit
Was this page helpful?

How to build and push a container image

Reviewed on 02 April 2025Published on 02 April 2021

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

Before you startLink to this anchor

To complete the actions presented below, you must have:

  • A Scaleway account logged into the console
  • Owner status or IAM permissions allowing you to perform actions in the intended Organization
  • Installed Docker engine or the Docker daemon locally
  • Created a Scaleway Registry namespace
  • A valid API key

How to create a DockerfileLink to this anchor

  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:

# Use the official Nginx image
FROM nginx:alpine
# Create simple HTML content directly in the Dockerfile
RUN echo "<!DOCTYPE html><html><head><title>Demo</title></head><body><h1>Hello Scaleway Serverless Containers!</h1><p>Served by Nginx</p></body></html>" > /usr/share/nginx/html/index.html
# For documentation purposes
EXPOSE 8080
# Modify Nginx configuration to listen on 8080
RUN sed -i 's/listen\(.*\)80;/listen 8080;/' /etc/nginx/conf.d/default.conf
# Start Nginx
CMD ["nginx", "-g", "daemon off;"]

How to build and push your image from your DockerfileLink to this anchor

  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 .
  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.

See also
How to manage a containerHow to add a custom domain to a container
Was this page helpful?
API DocsScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCareers
© 2023-2025 – Scaleway