How to create an image from scratch
This page shows how to create a new image from scratch. This process consists in building a root filesystem in an extra volume of one of your servers.
The following procedure will create an Ubuntu based image from scratch.
- 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
- You are running a Debianish system on your server
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 execute the following command:
Debootstrap is used to install Debian-like systems without using an installation disk. This way, you can create a fully functioning minimal installation.
Then, we create a bash script to build our image.
Each part of the script is described line by line.
Important: All scripts source are available on the official image.
Execute the script above on your server
chmod +x ./image_creation.sh && ./image_creation.sh.
Finally, stop your server.
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).
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.