VOOZH about

URL: https://thenewstack.io/grab-a-snapshot-of-your-container-image-with-checkpoint/

⇱ Grab a Snapshot of Your Container Image with Checkpoint - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2023-03-11 06:00:42
Grab a Snapshot of Your Container Image with Checkpoint
tutorial,
Cloud Native Ecosystem / Containers

Grab a Snapshot of Your Container Image with Checkpoint

When you start a container from a checkpoint, that container will be in the same state (including memory and processes) it was in when the checkpoint was created.
Mar 11th, 2023 6:00am by Jack Wallen
👁 Featued image for: Grab a Snapshot of Your Container Image with Checkpoint
Image via Pixabay.

Have you ever been in a situation where you have a Docker or Podman container running exactly how you need and wished you had the ability to save a snapshot of it, so you can ensure you’ve got a running state saved in case something goes awry with the container? Should disaster strike, you can simply start a new container using the snapshot.

That’d be nice, wouldn’t it?

Well, it’s actually possible, thanks to the checkpoint feature. Consider this feature as a handy way to back up a running container state, so you can use it any time you need. When you start a container from a checkpoint, that container will be in the same state (including memory and processes) it was in when the checkpoint was created. Another really cool feature of checkpoint is that, when you start a new container from a saved state, it will deploy faster than it originally did.

Bonus!

Now, before we continue, know that this is an experimental feature, so use it with caution. I would suggest using it on a non-production machine until you A) get the hang of it and B) you trust it. Until then, consider it only for testing purposes.

With that said, let’s create some checkpoints.

What You’ll Need

To use docker checkpoints, you’ll need a running instance of docker on a Ubuntu Server platform and a user with sudo privileges. That’s it. Let’s get to work.

Installing the Necessary Dependency

The first thing to do is install the lone dependency, Criu, the core Linux checkpoint utility. Log in to your Ubuntu Server instance and add the necessary repository for the software with the command:

sudo add-apt-repository ppa:criu/ppa

Update apt with:

sudo apt-get update

You can now install Criu with the command:

sudo apt-get install criu -y

Enabling Experimental Features

Now that you have Criu installed, you’ll need to enable experimental features for Docker. To do this, create a new file with the command:

sudo nano /etc/docker/daemon.json

Add the following three lines to the file:

{
"experimental": true
}

Save and close the file.

Restart Docker with:

sudo systemctl restart docker

Experimental features have now been enabled.

Deploy a Test Container

Instead of testing this on your currently running containers, let’s deploy a sample NGINX container to use. Deploy that container with the command:

docker run --name checkpoint-test -p 8005:80 -d nginx

Give the container a moment to spin up. You should be able to access the running container with the command:

docker exec -it checkpoint-test /bin/bash

Once inside the container, let’s modify the NGINX index.html page. Install the nano editor in the container with the following two commands:

apt update
apt install nano -y

Open index.html for editing with the command:

nano /usr/share/nginx/html/index.html

Change the contents of that file to:

<!doctype html>
<html lang=”en”>
<head>
  <meta charset=”utf-8″>
  <title>Checkpoint Test</title>
</head>
<body>
  <h2>Hello from The New Stack</h2>
</body>
</html>

Save and close the file. Exit from the container with the exit command and restart the container with:

docker restart checkpoint-test

Create Your First Checkpoint

We’re going to create a checkpoint, while still leaving the NGINX container running, which is achieved with the following command:

docker checkpoint create --leave-running=true checkpoint-test checkpoint00

You can name the checkpoint anything you like. In this demonstration, I’ve opted for checkpoint00. After you run the command, you’ll see:

checkpoint00

The checkpoint was successfully created.

Now, I have run into instances where Docker CE and the checkpoint feature failed to work. On the other hand, I’ve always had success installing the version of Docker that is found in the standard repositories, which can be installed with the command:

sudo apt-get install docker.io -y

Using a Checkpoint

Let’s say you do some work on the NGINX container and it fails on you. Since you’ve created a checkpoint, you can use it. Remember, our checkpoint is named checkpoint00. Let’s spin up a new container, which can be done with the command:

docker start --checkpoint checkpoint00 checkpoint-test

You might be smarter than me and give your checkpoints meaningful names, such as something that indicates the current state or a date. So instead of checkpoint00, you might have checkpoint022323 (for February 23, 2023).

You can verify the checkpoints you’ve created for a particular container. For example, to list all of the checkpoints you’ve created from checkpoint-test, issue the command:

docker checkpoint ls checkpoint-test

You might see something like this in the output:

CHECKPOINT NAME
checkpoint01
checkpoint02
checkpoint03
checkpoint04

But What about Podman?

Podman has a checkpoint feature built into it, but there’s a problem with its usage. The only way to checkpoint a container is to do so with sudo privileges. The catch is that is you deploy a container as a standard user, you can’t checkpoint it with sudo, because podman won’t see the running container (as it was deployed by another user).

However, if you deploy the podman container with root, like so:

sudo podman run --name checkpoint-test -p 8006:80 -d nginx

You can then checkpoint the container like so:

sudo podman container checkpoint checkpoint-test

As you’ve probably expected, doing this defeats the purpose of rootless containers. However, there are rumblings that eventually podman will allow checkpointing with rootless containers. We’ll see what the future holds.

And that’s all there is to using the checkpoint command for both Docker and Podman. Give this a try and see if it doesn’t help you always have a running state for the containers you depend on.

TRENDING STORIES
Jack Wallen is what happens when a Gen Xer mind-melds with present-day snark. Jack is a seeker of truth and a writer of words with a quantum mechanical pencil and a disjointed beat of sound and soul. Although he resides...
Read more from Jack Wallen
SHARE THIS STORY
TRENDING STORIES
NGINX is a sponsor of The New Stack.
TNS owner Insight Partners is an investor in: Docker.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.