Help


Community tutorials and documentations

How to create an image with Docker

How to create an image with Docker

This page shows how to create a new image with Docker. This process consists in building a root filesystem in an extra volume of one of your servers.

Requirements

  • You have an account and are logged into cloud.scaleway.com
  • You have configured your SSH Key
  • You have an additional volume attached to your server
  • Your server is running the Docker image from the InstantApps

When you create a server you have to select a base image. If you create your own base image, you can customize more deeply.

There are four steps to create a new image from scratch:

  • Create the root filesystem
  • Create a snapshot
  • Create an image from a snapshot
  • Create a new server with your image

Step 1 - Create the root filesystem

Connect to your server and clone the hello-world repository:

git clone https://github.com/online-labs/image-helloworld.git
cd image-helloworld

It is composed of two files:

  • a Makefile, which contains variables describing your image (version, name, title, description, URL)
  • a Dockerfile, which tells how your image is built (see the Dockerfile Reference)

The image can then be built on /dev/nbd1:

make install

Refer to the Image Tools Commands documentation for the possible usages of this Makefile.

Step 2 - Create a snapshot

At this point the extra volume contains a valid Ubuntu root filesystem. We must now transform this volume into a snapshot.

Once you server is powered off, from the servers page, select the server you created the image with.
Click the “Snapshot” button on the extra volume (in our example “volume_to_backup” - /dev/nbd1).

Volume snapshot

Step 3 - Create an image from snapshot

In the Control Panel, click “Volumes” in the compute section.
On this page, select the snapshot containing your rootfs and click “Create an image from snapshot”.

Step 4 - Create a new server with your image

Create a new server and choose your image in “My images” section.

Your server will start on your own “from scratch” image.

Discover a new cloud experience

Deploy SSD cloud servers in seconds.