docker.image.remove

Hook Path

runway.cfngin.hooks.docker.image.remove

Docker image remove hook.

Replicates the functionality of the docker image remove CLI command.

New in version 1.18.0.

Args

ecr_repo: Optional[Dict[str, Optional[str]]] = None

Information describing an ECR repository. This is used to construct the repository URL. If providing a value for this field, do not provide a value for repo or image.

If using a private registry, only repo_name is required. If using a public registry, repo_name and registry_alias.

account_id: Optional[str] = None

AWS account ID that owns the registry being logged into. If not provided, it will be acquired automatically if needed.

aws_region: Optional[str] = None

AWS region where the registry is located. If not provided, it will be acquired automatically if needed.

registry_alias: Optional[str] = None

If it is a public repository, provide the alias.

repo_name: str

The name of the repository.

force: Optional[bool] = False

Whether to force the removal of the image.

image: Optional[DockerImage] = None

A DockerImage object. This can be retrieved from hook_data for a preceding docker.image.build using the hook_data Lookup.

If providing a value for this field, do not provide a value for ecr_repo or repo.

noprune: Optional[bool] = False

Whether to delete untagged parents.

repo: Optional[str] = None

URI of a non Docker Hub repository where the image will be stored. If providing one of the other repo values or image, leave this value empty.

tags: Optional[List[str]] = ["latest"]

List of tags to remove.

Example

pre_deploy:
  - path: runway.cfngin.hooks.docker.login
    args:
      ecr: true
      password: ${ecr login-password}
  - path: runway.cfngin.hooks.docker.image.build
    args:
      ecr_repo:
        repo_name: ${cfn ${namespace}-test-ecr.Repository}
      tags:
        - latest
        - python3.9
  - path: runway.cfngin.hooks.docker.image.push
    args:
      image: ${hook_data docker.image}
      tags:
        - latest
        - python3.9

stacks:
  ...

post_deploy:
  - path: runway.cfngin.hooks.docker.image.remove
    args:
      image: ${hook_data docker.image}
      tags:
        - latest
        - python3.9