---
slug: "local-docker-image-deploy-to-remote-microk8s-ctr"
title: "How to Load a Local Docker Image into the MicroK8s Repository on a Remote Server"
description: "Deploy a locally built Docker image directly to a remote microk8s cluster via `ctr` (containerd CLI), without going through a registry."
url: "https://www.ytyng.com/en/blog/local-docker-image-deploy-to-remote-microk8s-ctr"
publish_date: "2022-06-19T11:51:28Z"
created: "2022-06-19T11:51:28Z"
updated: "2026-05-11T13:21:29.392Z"
categories: ["kubernetes"]
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20250605/7dbf3e8a32ba4eec99a7b8c9ee1b01e1.png.webp?width=768"
has_video: true
has_music: true
video_urls: ["https://media.ytyng.net/ytyng-blog/236/featured-video-1.mp4", "https://media.ytyng.net/ytyng-blog/236/featured-video-2.mp4", "https://media.ytyng.net/ytyng-blog/236/featured-video-3.mp4"]
music_urls: ["https://media.ytyng.net/ytyng-blog/236/featured-music-236-1.mp3", "https://media.ytyng.net/ytyng-blog/236/featured-music-236-2.mp3"]
lang: "en"
---

# How to Load a Local Docker Image into the MicroK8s Repository on a Remote Server

<p>When operating Kubernetes on a home server or an in-house server, here’s how to push a Docker image built on your local Mac to the server via SSH, without using an external image repository (like DockerHub or ECR).</p>
<h2>Loading a Local Docker Image as a Docker Image on a Remote Server</h2>
<p>First, regardless of Kubernetes, here’s how to send an image from your local Docker to a remote Docker:&nbsp;</p>
<pre>docker save ${image_name}:${image_tag} | ssh -C username@remote.example.com docker load</pre>
<p>With this command, you can directly send your local Docker image to the remote server.</p>
<p>However, compared to the method of using an image repository and using docker push / docker pull, this method does not perform differential updates for updated layers and transmits all layers entirely, making it slower in comparison.</p>
<h2>When Using MicroK8s (ctr) on a Remote Server</h2>
<p>If you are using MicroK8s on the server, a separate image repository for ctr is created apart from the Docker image repository within the server. Since MicroK8s uses ctr, images loaded with docker load cannot be used.</p>
<p>To import an image into ctr with MicroK8s:</p>
<pre>docker save mynginx &gt; myimage.tar<br />microk8s ctr image import myimage.tar</pre>
<p>Reference: https://microk8s.io/docs/registry-images</p>
<p>As shown above, use the <code>ctr image import</code> command. This command does not support importing from standard input, so you need to save the image to a file first.</p>
<p>To load a local image into the remote ctr:</p>
<pre>docker save ${image_name}:${image_tag} | ssh -C username@remote.example.com "cat &gt; /tmp/_exported_image.tar"<br />ssh username@remote.example.com "sudo microk8s ctr image import /tmp/_exported_image.tar"</pre>
<p>By writing to a file once and then using <code>microk8s ctr image import</code>, you can import the image.</p>
<p>Since sudo is required, it’s good to register the following in the sudoers file:</p>
<h4>/etc/sudoers.d/91-working-users</h4>
<pre>username ALL=(ALL) NOPASSWD: /snap/bin/microk8s</pre>
<p></p>
