SECURITY WARNING: Never run commands you don't understand. Always review code before execution. Use at your own risk.
Docker New Added 9 September 2026

docker: invalid reference format

Docker could not parse the image name. The usual causes are an uppercase letter in the repository part, a shell variable that expanded to nothing, or an unquoted path in a volume flag containing a space, which pushes the rest of the command into the position where the image name should be.

Quick fix

Read the commands before running them. Anything that restarts a service, deletes data or changes permissions should be tried on a non-production system first.

Quick fix
# Repository names are lower case, and a tag may not contain a slash
docker build -t myapp:1.0 .     # not MyApp:1.0

# An unset variable breaks the reference silently
echo "[$REGISTRY]"              # prints [] when unset
docker push "${REGISTRY:?set the registry first}/app:1.0"

# Quote volume paths, especially on macOS and Windows
docker run -v "$(pwd)/my data:/data" alpine ls /data

# Whitespace from a CI variable is a common and invisible cause
docker run "$(printf %s "$IMAGE" | tr -d '[:space:]')"

# Print the command before running it when it is built up dynamically
set -x

How to diagnose Docker errors

Docker errors are usually about the daemon (not running, or not reachable by your user), the host (disk full, port already bound), or the image (wrong architecture, rate-limited pull, missing credentials). Apple Silicon and ARM cloud instances made architecture mismatches far more common. exec format error is the signature, and it means an amd64 binary is being run on arm64 or vice versa.

If the quick fix above does not resolve it, work through these steps. They apply to this whole class of error, not just to this one message, which is usually what saves the time.

  1. Check the daemon before anything else: docker info. A "cannot connect to the Docker daemon" error is a socket permission or service problem, never an image problem.
  2. Reclaim space deliberately with docker system df to see where it went, then docker system prune. Build cache and dangling volumes are usually the bulk of it.
  3. For exec format error, run docker image inspect --format '{{.Architecture}}' image:tag and compare with uname -m. Build multi-arch images with docker buildx build --platform linux/amd64,linux/arm64.
  4. Find what is holding a port with ss -tulpn | grep :PORT (or lsof -i :PORT) rather than restarting Docker and hoping.
  5. Read build failures from the first error, not the last. BuildKit prints failing steps out of order, and the final line is often a downstream consequence.

Tools worth reaching for

  • docker info
  • docker system df
  • docker buildx
  • ss -tulpn
  • docker logs --tail 100

Authoritative references

Primary documentation for this error, worth reading before applying any fix in production.

docs.docker.com

Related Docker errors

See all 27 Docker errors →

Browse other categories

Something missing or wrong?

This entry is maintained by hand. If the fix is out of date, incomplete, or you have a better one, email a correction and it will be reviewed.