Bug 1374785

Summary: Docker save/load fails
Product: Container Development Kit (CDK) Reporter: Rich Lucente <rlucente>
Component: vmsAssignee: Lalatendu Mohanty <lmohanty>
Status: NEW --- QA Contact: Ondřej Pták <optak>
Severity: high Docs Contact: Robert Krátký <rkratky>
Priority: high    
Version: 2.1CC: jgreguske, kanderso, mepley, timoran
Target Milestone: ---   
Target Release: 2.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Rich Lucente 2016-09-09 15:40:05 UTC
Description of problem:
When using Docker save/load, I receive the following errors after attempting "docker load < tarfile":

Version-Release number of selected component (if applicable):
cdk 2.1.0 which includes docker-1.9.1-40.el7.x86_64

How reproducible:
Every time based on steps below

Steps to Reproduce:

In a nutshell, the steps below initiate a docker build based on the registry.access.redhat.com/rhel7.2 image and then docker save that image.  I copy the tar file to the host, destroy/recreate the guest vm, and attempt to docker load the tar file.  This consistently fails.

1.  Install cdk 2.1.0
2.  cd cdk/components/rhel/rhel-ose
3.  vagrant up
4.  vagrant ssh
5.  oc login 10.1.2.2:8443 -u openshift-dev  (use password 'devel')
6.  oc new-app https://github.com/rlucente-se-jboss/dockerfile-test.git

This github repo has a very simple Dockerfile that pulls the image registry.access.redhat.com/rhel7.2

7.  Once this builds, deploys, runs successfully, then
    docker save rhel7.2 > rhel7.2.tar
9.  exit (the guest vm)
10. scp vagrant.2.2:rhel7.2.tar . (vagrant password is 'vagrant')
11. vagrant destroy
12. vagrant up
13. vagrant ssh
14. cd /vagrant
15. docker load < rhel7.2.tar

Actual results:

Error response from daemon: Illegal tag name (sha256:abc233e53dae8786d395fbe84cb381e34353372e531bc1f2f5b1383934748fe2): only [A-Za-z0-9_.-] are allowed ('.' and '-' are NOT allowed in the initial), minimum 1, maximum 128 in length


Expected results:
Saved rhel7.2 docker image would load

Additional info:
After step 6 completes, 'docker images' reports:

...
registry.access.redhat.com/rhel7.2                          <none>              d5944004c6a0        6 weeks ago          201.6 MB
...

the rhel7.2 image has no tag.  Interestingly, if I vagrant destroy/vagrant up the cdk and then use the command:

docker pull rhel7.2

Docker uses default tag 'latest' and docker images will report:

...
registry.access.redhat.com/rhel7.2                          latest              d5944004c6a0        6 weeks ago         201.6 MB
...

But if I rerun the above steps to build the github repo, the builder will still pull an untagged image from the red hat registry and I'll have both images when I do a 'docker images'.  I'm trying to use 'docker save/load' so I can seed users during workshops without crushing the network.

Comment 1 Rich Lucente 2016-09-09 15:45:38 UTC
Any attempt to save an untagged image will succeed but load will fail

Comment 2 Rich Lucente 2016-09-09 16:30:56 UTC
This same issue happens with other software we ship. For example,

    sudo oc -n openshift import-image jboss-amq-62
    oc new-app jboss-amq-62 --name=broker -l name=broker

will also pull an untagged image for jboss-amq-62 and docker save/load will fail for that.  Full steps:

    vagrant destroy
    vagrant up
    vagrant ssh
    sudo oc login 10.1.2.2:8443 -u admin
    ... password is 'admin' ...
    sudo oc -n openshift import-image jboss-amq-62
    oc login 10.1.2.2:8443 -u openshift-dev
    ... password is 'devel' ...
    oc new-app jboss-amq-62 --name=broker -l name=broker
    ... wait for that to deploy/run ...
    oc delete all --all
    docker save jboss-amq-6/amq62-openshift > amq62-openshift.tar
    docker rmi -f 563bd64603e2
    ... basically remove the amq62 image ...
    docker load < amq62-openshift.tar

Error response from daemon: Illegal tag name (sha256:0a25571f68bd5951fd2d7b6467afa5e628345bc7d4e5a85872d4d9113039217a): only [A-Za-z0-9_.-] are allowed ('.' and '-' are NOT allowed in the initial), minimum 1, maximum 128 in length

Comment 3 Rich Lucente 2016-09-09 18:19:42 UTC
If I substitute the following in comment 2:

    sudo oc -n openshift import-image jboss-amq-62:latest
    oc new-app jboss-amq-62:latest --name=broker -l name=broker

The image is still pulled by the builder as untagged.

    docker images
    
REPOSITORY                                                  TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
registry.access.redhat.com/jboss-amq-6/amq62-openshift      <none>              563bd64603e2        7 weeks ago         604.1 MB

So save/load will still fail.

Comment 4 Michael Epley 2016-09-13 14:05:51 UTC
I also run into similar errors when I use private/locally deployed registries with simple hostnames (such as "registry"). This appears to be a docker parse issue with the tag; when I qualify my registry hostnames (in the docker configuration, tag names, etc) with a port (like "registry:5000") this appears to force the parsing to occur correctly. This may be a similar effect, as it looks like similar error, though here except it is affecting the tag.

Comment 5 Rich Lucente 2016-11-08 16:53:31 UTC
Interesting... I just tried instructions in comment 2 with nightly build of cdk for OCP 3.3.  Docker load worked however docker images returned:

REPOSITORY                                                  TAG                 IMAGE ID            CREATED             SIZE
<none>                                                      <none>              83eeaffd87f2        2 weeks ago         604 MB

for saved amq-62 image.  Both image id and tag are <none>.

$ sudo yum list installed | grep docker
docker.x86_64                    1.10.3-57.el7              @koji-override-0/7.2
docker-common.x86_64             1.10.3-57.el7              @koji-override-0/7.2
docker-rhel-push-plugin.x86_64   1.10.3-57.el7              @koji-override-0/7.2
docker-selinux.x86_64            1.10.3-57.el7              @koji-override-0/7.2
python-docker-py.noarch          1.9.0-1.el7                @koji-override-0/7.2

Comment 6 Rich Lucente 2016-11-08 16:55:17 UTC
> for saved amq-62 image.  Both image id and tag are <none>.

meant that repository and tag are <none>.