docker-image-resource
docker-image-resource copied to clipboard
How to pull and push a specific tagged docker image?
I am trying to use this Concourse CI resource to pulling specific "tagged" docker image. I tried working out a solution using both https://github.com/concourse/registry-image-resource and https://github.com/concourse/docker-image-resource. From the documentation, I dont see a way to achieve it.
In the below approach, Its declared as a resource and the tag remains same for rest of the execution.
- name: server-docker-image-artifactory
type: docker-image
icon: docker
source:
username: username
password: password
tag: "mytag"
repository: repo
- name: server-docker-image-bintray
type: docker-image
icon: docker
source:
username: username
password: password
tag: "mytag"
repository: repo
What I would like to achieve is, when declaring multiple steps, I would like to do something as below.
plan:
# Pull an image with a "tag" that was derived by some step in the pipeline
- get: server-docker-image-artifactory
params:
tag: my-dynamic tag
# Copy that specific tagged image from artifactory to bintray
- put: server-docker-image-bintray
inputs: ["server-docker-image-artifactory", "my-dynamic tag"]
params:
load: server-docker-image-artifactory
tag_file: my-dynamic tag
Right now... i am unable to provide something like above. It always ends up pulling the latest image. I tried the params such as "load", "load_file", "load_tag". But no luck Any directions?
I am having the same issue here with a similar configuration
- put: docker.myregistry
params:
load_repository: "myregistry/myimage"
load_file: OUTPUTS/image.tar # pulled in from a previous step
tag_file: OUTPUTS/my-dynamic.tag.txt # also pulled in from a previous step
Concourse always tries to push "myregistry/myimage:latest" even though the tag is specified in the tag_file.
All other experiments failed aswell (providing tag etc.)
UPDATE: It seems the resource is always appending :latest to the load_repository variable. Why is this even needed (though readme states it as optional, you get an error when it is missing)? Registry, repository, image name should be provided by the file being loaded. This should be an optional value if you want to overwrite the data provided by the tarball IMHO. I'd flag this as a bug.
When the image pulled in get step, it is based on the image digest here
https://github.com/concourse/docker-image-resource/blob/a8be31e9f597500657db1b773e178ad8a23eb602/assets/in#L56
And when it got saved with the name that with digest only, it loses repo and tag info https://github.com/concourse/docker-image-resource/blob/a8be31e9f597500657db1b773e178ad8a23eb602/assets/in#L72
So later when you load this tar in put step, I'd assume the docker image ls show sth like this:
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> 12344asdf 8 weeks ago 64.5 MB
So there is no way it can know what the repo ad tag are, and thus we have to make load_repository required when using load_file. Also we have to default to latest tag if load_tag is not provided.