How to Fix “Docker: Invalid Reference Format” Error

by Marlon Altenwerth
13 minutes read

How to Fix “Docker: Invalid Reference Format” Error


Docker Void Reference Layout

Docker lugs out it easy to construct, run, and juggle canisters. Singularly, you might experience the “Void Reference Layout” misjudgment when trying to run or construct an photograph. In unalike skins, the unhappiness is lugged upon by a tiny formatting sneak in the photograph name or tag. For instance, it might be due to capital letters, coherent personalities, or a absent out on merit. In this guide, I’ll define the behavior amasses of this misjudgment and how to recover them to keep translucent of it from snagging place again.

What Does the “Void Reference Layout” Pitfall Mean in Docker?

This misjudgment arises when Docker can’t examine the style of your photograph name. If the name is mistakenly structured, Docker stops working to process the application and tosses the “overrule reference style” misjudgment.

Docker calls for photograph monikers to adhere to a particular frame to occupational correctly. The basic syntax is:

[registry/][repository][:tag]

To make certain your photograph name is qualified, adhere to these pointers:

  • Gain make service of of lone lowercase letters. Docker performs not enable capital letters in photograph monikers.
  • You can require figures, hyphens (-), dots (.), and underscores (_) to uncouple words or incarnations, such as my-app_v1.0.
  • Remain translucent of coherent personalities pick @, #, !, or $, as Docker will certainly not accept them.
  • Docker photograph monikers have to also adhere to DNS naming pointers, which methodologies each sector of the name (established by slashes or dots) should be between 1 and 63 personalities long, and hyphens can’t be interjected at the start or end of a sector.
  • The complete photograph name, encompassing any kind of computer system unit registry and tag clarification, have to be certainly no a extensive quantity more than 255 personalities in overall.

Solving the “Void Reference Layout” Pitfall

Permit’s study the unalike behavior substantiations for the “overrule reference style” misjudgment and how to recover them:

Resources Letters in the Image Name

Docker intends photograph monikers to be in unanimously lowercase letters. Even a single capital letter can unleash the style to respite. For example, sprinting the obeying command will certainly unleash an misjudgment:

docker pull NGINX
Repo Name Have to Be Lowercase
How to Fix "Docker: Invalid Reference Format" Error 32

To guard versus this misjudgment, repeatedly double-examine that your photograph name is in lowercase in days gone by sprinting the command.

docker pull nginx
Gain make service of of Lowercase
How to Fix "Docker: Invalid Reference Format" Error 33

Momentous or Void Individualities

Intermittently clients unintentionally require personalities that Docker performs not enable. These icons require the @ indicator, stains, or personalities xeroxed from a internet website or paper that appearance behavior yet are not.

For example, the obeying command contains a coherent personality @, which will certainly unleash the identified misjudgment:

docker run ubuntu@:latest
Pitfall Momentous Symbol
How to Fix "Docker: Invalid Reference Format" Error 34

To reconcile this misjudgment, make certain that there are certainly no added personalities or formatting top priorities in the command. You can make service of a stark text editor to examine and unblemished the command (if necessary):

docker run ubuntu:latest
Remain translucent of Momentous Individualities
How to Fix "Docker: Invalid Reference Format" Error 35

A Colon Without a Tag

One of the unalike behavior miscues is placement a colon at the end of the photograph name yet not encompassing a tag. For example, we try the obeying command to tug Node:

docker pull node:

Docker intends something after the colon, such as unalike recent, 18-alpine, or any kind of unalike other qualified tag. If nothing is issued, the photograph name is contemplated incomplete and will certainly unleash the “overrule reference style” misjudgment:

Colon Without Tag
How to Fix "Docker: Invalid Reference Format" Error 36

To recover this, have a proper tag after the colon to render the photograph name complete and qualified:

docker pull node:latest
Have Tag After Colon
How to Fix "Docker: Invalid Reference Format" Error 37

File Training courses or Part Mounts using Rooms

When you require a document course that contains stains, specifically using replacements pick -v (volume place), Docker might misunderstand sections of the course as uncouple discussions or even part of the photograph name. Subsequently, you might experience sudden outcomes as proven below:

docker run -v /home/user/My Folder:/app ubuntu
Rooms In File Name
How to Fix "Docker: Invalid Reference Format" Error 38

To guard versus this, repeatedly dropped document paths using stains inside double bids, as proven below:

docker run -v "/home/user/My Folder:/app" ubuntu

Match “/abode/consumer/My Folder” using the actual course to the folder you pain to place applicable into the cyndrical tube.

Inappropriate Gain make service of of of Variable

When operating using Docker, it’s behavior to make service of variables in commands, specifically when epitomizing photograph incarnations. Singularly, if a variable pick $VERSION isn’t kit correctly, Docker might run applicable into crunches pick the “overrule reference style” misjudgment.

For example, we run the obeying command to tug Ubuntu from the Docker Hub:

docker pull ubuntu:$VERSION

Listed below, the $VERSION is supposed to stand for the symptom of the Ubuntu photograph you pain to tug. But if you shelter’t marked any kind of merit to it, Docker interprets the command as “docker tug ubuntu:”. This outcomes in an overrule photograph name because it ends using a colon and dearths the obligatory symptom tag.

Inappropriate Variable Gain make service of of
How to Fix "Docker: Invalid Reference Format" Error 39

To guard versus this, render sure unanimously variables earned make service of of in the command are accordingly characterized. In Linux, you can kit a variable making make service of of the obeying syntax.

$VERSION=latest

After that, tug the identified symptom by carrying out the obeying command.

docker pull ubuntu:$VERSION

In Windows CMD, you need to make service of the set keyword to define a variable (such as the symptom), and after that make service of %VARIABLE% syntax to reference it in commands pick docker tug.

set VERSION=latest
docker pull ubuntu:%VERSION%

Listed below, $VERSION holds the merit unalike recent, so Docker tugs the ubuntu:unalike recent photograph without any kind of top priorities. You can also assign a particular symptom, pick 18.04, if necessary.

Characterize Variable Properly
How to Fix "Docker: Invalid Reference Format" Error 40

Plagiarise and Paste Plights

Intermittently, clients plagiarize commands from digital tutorials or documents. These xeroxed commands might have covert personalities such as invisible stains, non-English spelling, or coherent quote marks. These personalities can silently respite your Docker command.

To guard versus this, it is repeatedly better to kind the command yourself when imaginable or paste it applicable into a stark text editor initially to separate undesired formatting.

Wrapping Up

Presently that you recognize the behavior amasses of the “Void Reference Layout” misjudgment in Docker and their respective solves, you’re in a a extensive quantity better position to guard versus this unhappiness in the future. From contemplating for capital letters to guaranteeing your variables are accordingly kit, these humble reminders can conserve you unalike time and aggravation. If you’re unanimously set to study a extensive quantity more, you might also pain to learn how to tag and press your own tradition Docker images to a computer system unit registry or how to unblemished up unused images to deepen your gadget readied.

Related Posts