Skip to content
Snippets Groups Projects
Commit 4252e026 authored by Riccardo Boero's avatar Riccardo Boero :innocent:
Browse files

Fixed problem with tagging command

parent 9de83d8e
No related branches found
No related tags found
No related merge requests found
......@@ -116,28 +116,32 @@ function push_image(image_name::String; auth_token::String="")
end
"""
tag_image(image_name::String, new_image_name::String; auth_token::String="")
tag_image(image_name::String, old_tag_name::String, new_image_name::String, new_tag_name::String; auth_token::String="")
Tags a Docker image with a new name. This operation is local to the Docker environment and does not involve network communication with a registry.
Tags a Docker image with a new name and tag. This operation is local to the Docker environment and does not involve network communication with a registry.
# Arguments
- `image_name::String`: The existing name (and tag) of the Docker image to be tagged. This is the source image name.
- `new_image_name::String`: The new name (and tag) to apply to the image. This name can include a new registry path, repository, and tag.
- `image_name::String`: The name of the Docker image to be tagged. This does not include the tag of the source image.
- `old_tag_name::String`: The existing tag of the Docker image to be tagged. This specifies the exact version of the `image_name` to be used.
- `new_image_name::String`: The new name to apply to the image. This name can include a new registry path and repository but does not include the tag.
- `new_tag_name::String`: The new tag to apply to the image. This specifies the version of the `new_image_name`.
- `auth_token::String=""` (optional): While tagging typically does not require authentication, if this function is part of a broader workflow that includes registry interaction, an auth token can be specified.
# Behavior
- Applies the `new_image_name` to the image identified by `image_name`. If the operation is successful, the image will be available under both the old and new names/tags.
- Applies the `new_image_name` and `new_tag_name` to the image identified by `image_name` and `old_tag_name`. If the operation is successful, the image will be available under both the old name/tag and the new name/tag.
# Example
> image_name = "myimage:oldtag"
> new_image_name = "myregistry.com/myimage:newtag"
> tag_image(image_name, new_image_name; auth_token="my_auth_token")
> image_name = "myimage"
> old_tag_name = "oldtag"
> new_image_name = "myregistry.com/myimage"
> new_tag_name = "newtag"
> tag_image(image_name, old_tag_name, new_image_name, new_tag_name; auth_token="my_auth_token")
This example retags `myimage:oldtag` as `myregistry.com/myimage:newtag`, potentially preparing it for pushing to `myregistry.com`.
"""
function tag_image(image_name::String, new_image_name::String; auth_token::String="")
function tag_image(image_name::String, old_tag_name::String, new_image_name::String, new_tag_name::String; auth_token::String="")
# Endpoint to tag the image
tag_endpoint = "images/$image_name/tag?repo=$new_image_name"
tag_endpoint = "images/$image_name:$old_tag_name/tag?repo=$new_image_name&tag=$new_tag_name"
# Call the docker_api_post function to tag the image
docker_api_post(tag_endpoint, Dict(), auth_token=auth_token)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment