Local Machine (Desktop/Laptop) → Azure VM (Linux & Windows)
Use this guide to move Docker images to an Azure VM with restricted networking by saving the image on your laptop, uploading the file to your anDREa workspace, and loading it on the VM.
0) Prerequisites
- You have the required privileges to upload files to your anDREa workspace.
- Docker is installed on your laptop and on the VM.
- Image OS/architecture match:
- Linux VM → Linux images (linux/amd64 or linux/arm64).
- Windows VM → Windows images (e.g., windows/nanoserver, windows/servercore).
- Architecture matters (amd64 vs arm64)
1) On Your Laptop (common to Linux/Windows)
- Pull the right platform (adjust name/tag):
- # Most Azure Linux VMs are x86_64 → linux/amd64
- docker pull --platform=linux/amd64 myregistry/myimage:tag
- Save to a tar file (keeps layers & metadata):
- docker save -o myimage.tar myregistry/myimage:tag
- (Optional, but handy) Compress to reduce upload size:
- # If gzip is available
- gzip -9 myimage.tar # → myimage.tar.gz
- > On Windows, you can use tar.exe (built‑in) or 7‑Zip to compress.
- Upload ‘myimage.tar’ (or .tar.gz) to your anDREa workspace using any of the available upload mechanisms.
- Bundle multiple images (Compose stack)
- Bash (Linux/macOS):
- docker compose pull
- docker save -o stack.tar $(docker compose images --quiet | sort -u)
- PowerShell (Windows):
- docker compose pull
- $imgs = docker compose images --quiet | Sort-Object -Unique
- docker save -o stack.tar $imgs
2) On the Azure Linux VM
- Locate the upload on the mounted share (example paths below).
- Load the image into Docker:
- # If you uploaded a .tar.gz, Docker can auto-detect gzip
- sudo docker load -i /mnt/data/inbox/transfer/myimage.tar.gz
- # Or plain tar
- sudo docker load -i /mnt/data/inbox/transfer/myimage.tar
- Verify and run:
- docker images | grep myimage
- docker run --rm -it myregistry/myimage:tag
3) On the Azure Windows VM
- Ensure you are using the correct container mode:
- Windows Server typically runs Windows containers.
- Windows 10/11 with Docker Desktop can run Linux or Windows containers (toggle mode).
A) Windows Server (Docker Engine, Windows containers)
- Open PowerShell as Administrator.
- Load the image from the share:
- docker load -i \\fileserver\share\myimage.tar # UNC path
- # or if mapped to drive Z:
- docker load -i Z:\myimage.tar
- Verify and run:
- docker images | findstr myimage
- docker run --rm -it myregistry/myimage:tag
- Make sure the image is a Windows base image (e.g., nanoserver/servercore) when in Windows container mode.
B) Windows 10/11 with Docker Desktop (Linux or Windows containers)
- Switch container mode if needed:
- Linux images: set Docker Desktop to Linux containers (WSL2 backend).
- Windows images: switch to Windows containers.
- (Quick check)
- docker info --format '{{.OSType}}/{{.Architecture}}'
- Load the image from the share:
- docker load -i Z:\myimage.tar
- Verify & run as above.
4) Quick Checks & Commands
- VM architecture (Linux):
- uname -m → x86_64 = amd64, aarch64 = arm64.
- Docker daemon OS/arch:
- docker info --format '{{.OSType}}/{{.Architecture}}'
- List images with digests:
- docker images --digests myregistry/myimage
- Test without network:
- docker run --rm myregistry/myimage:tag cmd args
5) Path Examples for the File Share
- Linux VM: /mnt/data/inbox/transfer-2019-08-21/<filename>
- Windows VM:
- \\storageacct.file.core.windows.net\share\folder\myimage.tar or mapped drive like Z:\folder\myimage.tar.