Is it possible to download Docker image without installing Docker on the machine (download image from Docker Hub)? (Edited)

Hi everyone! I need to fetch images — say, ubuntu:latest — from Docker Hub on a server that doesn’t have Docker installed. I need a method to download an image (ideally as a tarball or other portable format) that does not use the Docker CLI. I’ve reviewed the docs but couldn’t find a suitable solution. Can anyone share examples or tools that download the image not utilizing docker pull?

Ewan Schneider

6 months ago

15 answers

252 views

Rating

12
Answer

Answers

Dimitry Klein

6 months ago

1 comment

Edited

Rating

00

You can use the download-frozen-image-v2.sh script from the Moby project, which allows you to download an image from the Docker Hub without without having a Docker client installed. The script downloads all the image layers (blobs) and saves them in a specified directory, preserving the necessary structure. After that, you can combine the downloaded layers into a single tar archive, which can then be transferred to a host where Docker is installed and loaded using the docker load command.

Usage example:

1. Downloading the image:

Run the following bash command to download the debian:stable image into the /data/debian_image directory:

		
bash download-frozen-image-v2.sh /data/debian_image debian:stable

In this step, the script reaches out to Docker Hub, retrieves the image manifest (which contains metadata about the image and its layers), and downloads each layer into the specified directory. The directory /data/debian_image will then hold all the files needed to reconstruct the image, maintaining the structure required by Docker.

2. Combining layers into an archive:

Once all layers are successfully downloaded, create a single tar archive with this command:

		
tar -cC '/data/debian_image' . > debian.tar

This command packages the entire contents of /data/debian_image into the file debian.tar. The archive will contain all the layers and metadata needed next.

3. Transferring and importing:

Next, transfer the debian.tar archive to the target machine where Docker is installed. On the target machine, run:

		
docker load < debian.tar

The docker load command imports the image from the tar archive, restoring it in Docker's local storage. The archive will contain all the layers and metadata needed to import the image into Docker.

In my experience, this approach really comes in handy when Docker installation isn't an option—whether because of strict security policies, limited resources, or just because the server doesn't have Docker. I've used the download-frozen-image-v2.sh script to whip up a portable image archive that I can easily move around and load into a Docker environment later. It's been a reliable solution when things are a bit tricky.

Reply

    Ewan Schneider

    6 months ago

    Rating

    00

    Dmitry, thanks so much for your reply! Your explanation using the download-frozen-image-v2 script was exactly what I needed. I followed your advice and was able to download the image layers into a folder, package them into a tarball, and then move that tarball over to another server with Docker installed. The whole process went off with no hitches.

    Your explanation was super clear and made everything feel really approachable — it was exactly the workaround I was looking for. Thanks again for sharing your experience; it truly made my life a lot easier!

    Reply

Ralf Bauer

6 months ago

1 comment

Rating

00

I wrote a PowerShell script to download Docker images. Here’s a snippet:

		
$image = "ubuntu" $tag = "latest" $repository = "library/$image" # Get access token for the repository $token = (Invoke-RestMethod "https://auth.docker.io/token?service=registry.docker.io&scope=repository:$repository:pull").token # Request the image manifest $manifestUrl = "https://registry-1.docker.io/v2/$repository/manifests/$tag" $headers = @{ "Authorization" = "Bearer $token" "Accept" = "application/vnd.docker.distribution.manifest.v2+json" } $manifest = Invoke-RestMethod -Uri $manifestUrl -Headers $headers # Determine layer list (supporting both schema v2 and older manifests) $layers = if ($manifest.layers) { $manifest.layers } else { $manifest.fsLayers } # Download each layer foreach ($layer in $layers) { $digest = if ($layer.digest) { $layer.digest } else { $layer.blobSum } $filename = ($digest -replace "[:/]", "_") + ".gz" $blobUrl = "https://registry-1.docker.io/v2/$repository/blobs/$digest" Invoke-WebRequest -Uri $blobUrl -Headers @{ "Authorization" = "Bearer $token" } -OutFile $filename Write-Host "Downloaded layer: $filename" }

Reply

    Ralf Bauer

    6 months ago

    1 comment

    Edited

    Rating

    00

    Update: I found a more detailed PowerShell script on GitHub for downloading images from Docker Hub: Here.

    Reply

      Ewan Schneider

      6 months ago

      Rating

      00

      Thank you very much, Ralph, for your help.

      Unfortunately, I didn't say in the question that I use Linux, but I'm sure your example will be helpful and give useful ideas to someone who needs them.

      Reply

Alex Wolf

6 months ago

1 comment

Rating

00

Frankly, if you have internet access to DockerHub without limits, it's easier to temporarily install Docker or Podman and use the standard Docker tools.

Workarounds like skopeo or the API method add complexity and potential compatibility issues.

I don't see why you would load the image if you can't use it.

Reply

    Ewan Schneider

    6 months ago

    1 comment

    Rating

    00

    Alex, installing Docker on a server that doesn't use it wastes resources and may violate security policies. That's exactly why I'm asking this question—to find alternative options and seek help from the community.

    My task is to pull an image from the Docker registry to inspect and analyze it in a standalone environment that adheres to corporate security policies prohibiting Docker installation. I need this process to prepare images for a local registry and subsequently deploy them on hosts.

    Reply

      Alex Wolf

      6 months ago

      Rating

      00

      Ivan, I realize that installing Docker can be problematic due to security policies and extra resources. But workarounds often lead to compatibility issues, so if a temporary installation of Docker or Podman is acceptable, it would be a more reliable solution.

      Reply

Anna Meyer

6 months ago

1 comment

Edited

Rating

00

Downloading a Docker image without Docker on a machine using HTTP API V2.

1. Run a request to retrieve the image manifest (metadata):

		
bash curl -sSL -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \ https://registry.hub.docker.com/v2/library/ubuntu/manifests/latest

This returns a JSON manifest listing the image layers.

2. Parse the JSON to get a list of layers with their digest.

3. Download the layers:

For each digest, download the corresponding blob using a URL like:

		
bash curl -sSL https://registry.hub.docker.com/v2/library/ubuntu/blobs/ -o .tar.gz

4. Assemble the archive:

Once all layers are downloaded, manually bundle them into a tar archive preserving the Docker image structure.

This method involves some manual parsing and assembly, but it offers flexibility if you need to retrieve an image for specialized purposes.

Reply

    Ewan Schneider

    6 months ago

    1 comment

    Rating

    00

    Thank you, Anna! Do you know of any ready-made scripts for this?

    Reply

      Anna Schmidt

      6 months ago

      Rating

      00

      I haven't seen a complete out-of-the-box solution, though there are Python examples using the requests library. For most cases, skopeo remains the most convenient option.

      Reply

Alessandro Gallo

6 months ago

1 comment

Edited

Rating

00

Using Skopeo to download a docker image without using docker:

I rely on skopeo for this task because it allows me to seamlessly copy container images between registries and save them as either OCI images or Docker archives — all without needing a running Docker daemon. This is especially beneficial in environments where installing Docker is not an option due to security policies or resource constraints.

The process is straightforward. For example, you can download the Ubuntu image with the tag latest as a tar file by running:

		
bash skopeo copy docker://docker.io/library/ubuntu:latest docker-archive:ubuntu_latest.tar:latest

In this command, Skopeo connects to the Docker registry, fetches the specified image, and converts it into a tar archive. This tarball can then be used for later import into a local registry or further analysis.

It's important to ensure that you’re using an up-to-date version of Skopeo and that your operating system meets its dependency requirements. This not only guarantees compatibility but also takes advantage of the latest features and security updates provided by the tool.

Overall, Skopeo offers a robust and efficient solution for managing Docker containers and container images in environments where traditional Docker installation is not feasible.

Reply

    Ewan Schneider

    6 months ago

    1 comment

    Rating

    00

    Thanks, Sergio! How do I handle authentication for private images?

    Reply

      Sergio Weber

      6 months ago

      1 comment

      Rating

      00

      Handling authentication for private images with Skopeo is quite straightforward. Skopeo provides built-in flags to pass your credentials directly on the command line. Here’s how you can manage it:

      Use the --src-creds flag to supply credentials for the source (and --dest-creds for the destination if needed). These flags expect a value in the format username:password.

      For example:

      		
      skopeo copy --src-creds myusername:mypassword docker://docker.io/library/ubuntu:latest docker-archive:ubuntu_latest.tar:lates

      This command authenticates to your private repository using the provided credentials.

      Be cautious with embedding credentials directly in your command line, as they might be stored in your shell history. To improve security, consider using environment variables or a dedicated credentials file.

      Authentication Files:

      Skopeo also supports the use of an authentication file through the --authfile flag. This file can securely store your credentials, reducing the risk of exposing them in command histories or scripts.

      Reply

        Ewan Schneider

        6 months ago

        Rating

        00

        Thank you, Sergio! That does a great job of clarifying the situation. I appreciate the detailed explanation. Your help is very much appreciated!

        Reply