DEV Community

Janak Shrestha
Janak Shrestha

Posted on

Save, Load and Transfer Docker Image

One of the DevOps team members was working on to create a new custom docker image on App Server 1 in Stratos DC. He is done with his changes and image is saved on same server with name apps:nautilus. Recently a requirement has been raised by a team to use that image for testing, but the team wants to test the same on App Server 3. So we need to provide them that image on App Server 3 in Stratos DC.

a. On App Server 1 save the image apps:nautilus in an archive.
b. Transfer the image archive to App Server 3.
c. Load that image archive on App Server 3 with same name and tag which was used on App Server 1.

Note: Docker is already installed on both servers; however, if its service is down please make sure to start it.


Connect to App Server 1

ssh tony@stapp01
sudo -i
Enter fullscreen mode Exit fullscreen mode

Password for tony: Ir0nM@n


Verify the Image Exists

docker images | grep apps
Enter fullscreen mode Exit fullscreen mode

Output:

apps         nautilus   4aa886374dbd   About a minute ago   145MB
Enter fullscreen mode Exit fullscreen mode

The image apps:nautilus is present on App Server 1.


Save the Image to an Archive

docker save -o /tmp/apps_nautilus.tar apps:nautilus
Enter fullscreen mode Exit fullscreen mode

Verify the archive was created:

ls -lh /tmp/apps_nautilus.tar
Enter fullscreen mode Exit fullscreen mode

Output:

-rw------- 1 root root 150M Oct 27 11:27 /tmp/apps_nautilus.tar
Enter fullscreen mode Exit fullscreen mode

The archive is 150MB in size.


Transfer the Archive to App Server 3

scp /tmp/apps_nautilus.tar banner@stapp03:/tmp/
Enter fullscreen mode Exit fullscreen mode

Transfer progress:

apps_nautilus.tar                                                 100%  149MB 106.4MB/s   00:01
Enter fullscreen mode Exit fullscreen mode

The archive was transferred successfully to App Server 3.


Connect to App Server 3

ssh banner@stapp03
sudo -i
Enter fullscreen mode Exit fullscreen mode

Password for banner: BigGr33n


Verify Docker Service is Running

systemctl status docker
Enter fullscreen mode Exit fullscreen mode

Output:

● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: disabled)
     Active: active (running) since Tue 2026-10-27 11:17:35 UTC; 11min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 1379 (dockerd)
      Tasks: 21
     Memory: 29.7M (peak: 32.7M)
        CPU: 227ms
     CGroup: /system.slice/docker.service
             └─1379 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Enter fullscreen mode Exit fullscreen mode

Docker service is active and running.

Ensure Docker starts on boot:

systemctl enable docker
Enter fullscreen mode Exit fullscreen mode

Verify the Archive on App Server 3

ls -lh /tmp/apps_nautilus.tar
Enter fullscreen mode Exit fullscreen mode

Output:

-rw------- 1 banner banner 150M Oct 27 11:28 /tmp/apps_nautilus.tar
Enter fullscreen mode Exit fullscreen mode

The archive is present on App Server 3.


Load the Image Archive

docker load -i /tmp/apps_nautilus.tar
Enter fullscreen mode Exit fullscreen mode

Output:

5cac300e390e: Loading layer    113MB/113MB
5f4be2c3bade: Loading layer  10.24kB/10.24kB
69aa46425f87: Loading layer   43.6MB/43.6MB
Loaded image: apps:nautilus
Enter fullscreen mode Exit fullscreen mode

The image layers were loaded successfully.

Alternative syntax:

docker load < /tmp/apps_nautilus.tar
Enter fullscreen mode Exit fullscreen mode

Output:

Loaded image: apps:nautilus
Enter fullscreen mode Exit fullscreen mode

Verify the Image on App Server 3

docker images | grep apps
Enter fullscreen mode Exit fullscreen mode

Output:

apps         nautilus   4aa886374dbd   4 minutes ago   145MB
Enter fullscreen mode Exit fullscreen mode

The image apps:nautilus is loaded on App Server 3 with the same image ID (4aa886374dbd), name, and tag as on App Server 1.


Complete Command Sequence

On App Server 1

ssh tony@stapp01
sudo -i

docker images | grep apps
docker save -o /tmp/apps_nautilus.tar apps:nautilus
ls -lh /tmp/apps_nautilus.tar

scp /tmp/apps_nautilus.tar banner@stapp03:/tmp/
Enter fullscreen mode Exit fullscreen mode

On App Server 3

ssh banner@stapp03
sudo -i

systemctl status docker
systemctl enable docker
ls -lh /tmp/apps_nautilus.tar
docker load -i /tmp/apps_nautilus.tar
docker images | grep apps
Enter fullscreen mode Exit fullscreen mode

Top comments (0)