title: How are Docker image names parsed?
body: <p>When doing a <code>docker push</code> or when pulling an image, how does Docker determine if there is a registry server in the image name or if it is a path/username on the default registry (e.g. Docker Hub)?</p>
  
  <p>I'm seeing the following from the <a href="https://github.com/docker/docker/blob/master/image/spec/v1.1.md" rel="noreferrer">1.1 image specification</a>:</p>
  
  <blockquote>
    <p><strong>Tag</strong></p>
    
    <p>A tag serves to map a descriptive, user-given name to any single image
    ID. Tag values are limited to the set of characters [a-zA-Z_0-9]. </p>
    
    <p><strong>Repository</strong></p>
    
    <p>A collection of tags grouped under a common prefix (the name component
    before :). For example, in an image tagged with the name my-app:3.1.4,
    my-app is the Repository component of the name. A repository name is
    made up of slash-separated name components, optionally prefixed by a
    DNS hostname. The hostname must follow comply with standard DNS rules,
    but may not contain _ characters. If a hostname is present, it may
    optionally be followed by a port number in the format :8080. Name
    components may contain lowercase characters, digits, and separators. A
    separator is defined as a period, one or two underscores, or one or
    more dashes. A name component may not start or end with a separator.</p>
  </blockquote>
  
  <p>For the DNS host name, does it need to be fully qualified with dots, or is "my-local-server" a valid registry hostname? For the name components, I'm seeing periods as valid, which implies "team.user/appserver" is a valid image name. If the registry server is running on port 80, and therefore no port number is needed on the hostname in the image name, it seems like there would be ambiguity between the hostname and the path on the registry server. I'm curious how Docker resolves that ambiguity.</p>