docker-image-resource icon indicating copy to clipboard operation
docker-image-resource copied to clipboard

invalid reference format error in docker-image-resource put

Open chris-cinqsociety opened this issue 6 years ago • 7 comments

Currently trying to build and push docker images, issue is that I'm receiving a this message from concourse during wordpress-release put step:

waiting for docker to come up...
invalid reference format

Here's the important bit of the Concourse Pipeline.

- name: wordpress-release
  type: docker-image
  source:
        repository: #############.dkr.ecr.eu-west-1.amazonaws.com/wordpress-release
        aws_access_key_id: #############
        aws_secret_access_key: #############
- name: mysql-release
  type: docker-image
  source:
        repository: #############.dkr.ecr.eu-west-1.amazonaws.com/mysql-release
        aws_access_key_id: #############
        aws_secret_access_key: #############
jobs:
- name: job-hello-world
  plan:
  - get: wordpress-website
  - task: write-release-tag
    config:
      platform: linux
      image_resource:
        type: registry-image
        source: { repository: alpine/git }
      inputs:
        - name: wordpress-website
      outputs:
        - name: tags
      run:
        dir: wordpress-website
        path: sh
        args:
          - -exc
          - |
            printf $(basename $(git remote get-url origin) | sed 's/\.[^.]*$/-/')$(git tag --points-at HEAD) > ../tags/release-tag
  - put: wordpress-release
    params:
      build: ./wordpress-website/.
      dockerfile: wordpress-website/shared-wordpress-images/wordpress/wordpress-release/Dockerfile
      tag_file: tags/release-tag
  - put: mysql-release
    params:
      build: ./wordpress-website/
      dockerfile: wordpress-website/shared-wordpress-images/db/mysql-release/Dockerfile
      tag_file: tags/release-tag

Those images contain FROM #############.dkr.ecr.eu-west-1.amazonaws.com/shared-mysql (and shared-wordpress) could this be an issue?

The tag_file: tags/release-tag, doesn't seem to be the issue as even without it, this still happens.

This is Concourse 5.0 running on top of Docker in Windows 10.

chris-cinqsociety avatar Mar 24 '19 15:03 chris-cinqsociety

We had this same issue. Turned out that the Dockerfile had DOS line endings and it was treating the carriage return as part of the base image tag.

GJKrupa avatar Dec 11 '19 09:12 GJKrupa

Just had the same problem caused by including the tag in the resource name.

Correct format is:

- name: docker-source-something
  type: docker-image
  source:
    repository: something/something-else
    tag: 'latest'
    username: user
    password: pass

jaltevolmer avatar Jan 06 '20 17:01 jaltevolmer

@chris-cinqsociety Did you find any solution for the issue you posted? Facing exact same issue. For me it's concourse:5.7 running on linux.

thapabishwa avatar Feb 05 '20 15:02 thapabishwa

same issue

ghost avatar Feb 18 '20 21:02 ghost

Please make sure your dockerfile is able to run with a docker build first. Otherwise you could post your dockerfile here if you are still having this problem. Thx.

xtremerui avatar May 14 '20 16:05 xtremerui

Please make sure your dockerfile is able to run with a docker build first. Otherwise you could post your dockerfile here if you are still having this problem. Thx.

Hi @xtremerui , the dockerfile that I use is operating fine in Jenkins. However, it has FROM #############.dkr.ecr.eu-west-1.amazonaws.com/my-image directive.

When concourse tries to build the image, this is what I see.

put: my-image-ecr

waiting for docker to come up...
latest: Pulling from my-image
a1125296b23d: Pulling fs layer
3c742a4a0f38: Pulling fs layer
4c5ea3b32996: Pulling fs layer
1b4be91ead68: Pulling fs layer
de80f51034bb: Pulling fs layer
5c4607a0bb95: Pulling fs layer
9c9d562f6f46: Pulling fs layer
c1e89847e14a: Pulling fs layer
53772b10c7aa: Pulling fs layer
8de909fc246c: Pulling fs layer
fe6985e2d65e: Pulling fs layer
a38ef3ca0467: Pulling fs layer
00bf30667011: Pulling fs layer
6e036fc39487: Pulling fs layer
de80f51034bb: Waiting
5c4607a0bb95: Waiting
8de909fc246c: Waiting
c773a1ea89c0: Pulling fs layer
fcb139b93030: Pulling fs layer
189820ee2908: Pulling fs layer
c7667a02f43a: Pulling fs layer
4d2fec27450b: Pulling fs layer
c1e89847e14a: Waiting
1b4be91ead68: Waiting
b6fb891d4772: Pulling fs layer
a38ef3ca0467: Waiting
53772b10c7aa: Waiting
00bf30667011: Waiting
fcb139b93030: Waiting
4d2fec27450b: Waiting
6e036fc39487: Waiting
189820ee2908: Waiting
c7667a02f43a: Waiting
b6fb891d4772: Waiting
9c9d562f6f46: Waiting
c773a1ea89c0: Waiting
fe6985e2d65e: Waiting
4c5ea3b32996: Verifying Checksum
4c5ea3b32996: Download complete
3c742a4a0f38: Verifying Checksum
3c742a4a0f38: Download complete
1b4be91ead68: Verifying Checksum
1b4be91ead68: Download complete
a1125296b23d: Verifying Checksum
a1125296b23d: Download complete
5c4607a0bb95: Verifying Checksum
5c4607a0bb95: Download complete
a1125296b23d: Pull complete
de80f51034bb: Verifying Checksum
de80f51034bb: Download complete
9c9d562f6f46: Download complete
3c742a4a0f38: Pull complete
4c5ea3b32996: Pull complete
1b4be91ead68: Pull complete
8de909fc246c: Download complete
de80f51034bb: Pull complete
c1e89847e14a: Verifying Checksum
c1e89847e14a: Download complete
5c4607a0bb95: Pull complete
53772b10c7aa: Verifying Checksum
53772b10c7aa: Download complete
9c9d562f6f46: Pull complete
c1e89847e14a: Pull complete
53772b10c7aa: Pull complete
8de909fc246c: Pull complete
00bf30667011: Verifying Checksum
00bf30667011: Download complete
a38ef3ca0467: Verifying Checksum
c773a1ea89c0: Verifying Checksum
c773a1ea89c0: Download complete
fcb139b93030: Verifying Checksum
fcb139b93030: Download complete
fe6985e2d65e: Verifying Checksum
fe6985e2d65e: Download complete
fe6985e2d65e: Pull complete
189820ee2908: Verifying Checksum
189820ee2908: Download complete
a38ef3ca0467: Pull complete
00bf30667011: Pull complete
c7667a02f43a: Verifying Checksum
c7667a02f43a: Download complete
4d2fec27450b: Verifying Checksum
4d2fec27450b: Download complete
b6fb891d4772: Verifying Checksum
b6fb891d4772: Download complete
6e036fc39487: Verifying Checksum
6e036fc39487: Download complete
6e036fc39487: Pull complete
c773a1ea89c0: Pull complete
fcb139b93030: Pull complete
189820ee2908: Pull complete
c7667a02f43a: Pull complete
4d2fec27450b: Pull complete
b6fb891d4772: Pull complete
Digest: sha256:9313b989e662fc6a0f911376a9f647613fd59f35b69761850a7f43a75e4ac6e8
Status: Downloaded newer image for ########.dkr.ecr.us-east-1.amazonaws.com/my-image:latest
invalid reference format

The Dockerfile looks like

ARG ARTIFACT_TAG
FROM  ########.dkr.ecr.us-east-1.amazonaws.com/my-image:latest as builder
<some other docker directives here....>
FROM  ########.dkr.ecr.us-east-1.amazonaws.com/my-image:${ARTIFACT_TAG}
<some other docker directives here....>

Environment: Arch Linux x64

thapabishwa avatar Jul 31 '20 20:07 thapabishwa

Hi @xtremerui , I tried removing ${ARTIFACT_TAG} from the second FROM directive and the build works now. This (kinda) solves my issue.

thapabishwa avatar Aug 01 '20 07:08 thapabishwa