{"id":20779715,"url":"https://github.com/praekeltfoundation/docker-ci-deploy","last_synced_at":"2025-07-29T11:09:51.309Z","repository":{"id":57423213,"uuid":"58929455","full_name":"praekeltfoundation/docker-ci-deploy","owner":"praekeltfoundation","description":"Python script to help push Docker images to a registry using CI services","archived":false,"fork":false,"pushed_at":"2018-12-18T08:00:01.000Z","size":129,"stargazers_count":19,"open_issues_count":2,"forks_count":1,"subscribers_count":16,"default_branch":"develop","last_synced_at":"2025-07-05T23:46:09.859Z","etag":null,"topics":["cli-utility","continuous-integration","docker","docker-image","docker-registry","travis-ci"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/praekeltfoundation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-16T12:07:13.000Z","updated_at":"2023-06-15T18:27:15.000Z","dependencies_parsed_at":"2022-09-05T11:10:33.156Z","dependency_job_id":null,"html_url":"https://github.com/praekeltfoundation/docker-ci-deploy","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/praekeltfoundation/docker-ci-deploy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praekeltfoundation%2Fdocker-ci-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praekeltfoundation%2Fdocker-ci-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praekeltfoundation%2Fdocker-ci-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praekeltfoundation%2Fdocker-ci-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/praekeltfoundation","download_url":"https://codeload.github.com/praekeltfoundation/docker-ci-deploy/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praekeltfoundation%2Fdocker-ci-deploy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267677341,"owners_count":24126313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli-utility","continuous-integration","docker","docker-image","docker-registry","travis-ci"],"created_at":"2024-11-17T13:29:20.782Z","updated_at":"2025-07-29T11:09:51.276Z","avatar_url":"https://github.com/praekeltfoundation.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-ci-deploy\n\n[![PyPI](https://img.shields.io/pypi/v/docker-ci-deploy.svg)](https://pypi.python.org/pypi/docker-ci-deploy)\n[![Build Status](https://travis-ci.org/praekeltfoundation/docker-ci-deploy.svg?branch=develop)](https://travis-ci.org/praekeltfoundation/docker-ci-deploy)\n[![codecov](https://codecov.io/gh/praekeltfoundation/docker-ci-deploy/branch/develop/graph/badge.svg)](https://codecov.io/gh/praekeltfoundation/docker-ci-deploy)\n\n\u003e NOTE: The `-l`/`--login` parameter (and associated `-d`/`--debug` parameter) has been removed in version 0.3.0. Use a manual `docker login` command in the `before_deploy` section of your Travis file (or equivalent) to log in.\n\nA command-line tool to help generate tags and push Docker images to a registry. Simplifies deployment of Docker images from CI services such as Travis CI.\n\nIn a single command, `docker-ci-deploy` can:\n* Change the tags on images\n* Add version information to image tags\n* Add registry addresses to image tags\n* Push tags to a registry\n\nThe best way to try out `docker-ci-deploy` is to give it a spin with the `--dry-run` flag and observe all the `docker` commands that it *would* invoke:\n```\n\u003e $ docker-ci-deploy --version 2.7.13 --version-semver --version-latest \\\n      --registry registry:5000 --dry-run \\\n      praekeltorg/alpine-python \\\n      praekeltorg/alpine-python:onbuild\n\ndocker tag praekeltorg/alpine-python registry:5000/praekeltorg/alpine-python:2.7.13\ndocker tag praekeltorg/alpine-python registry:5000/praekeltorg/alpine-python:2.7\ndocker tag praekeltorg/alpine-python registry:5000/praekeltorg/alpine-python:2\ndocker tag praekeltorg/alpine-python registry:5000/praekeltorg/alpine-python:latest\ndocker tag praekeltorg/alpine-python:onbuild registry:5000/praekeltorg/alpine-python:2.7.13-onbuild\ndocker tag praekeltorg/alpine-python:onbuild registry:5000/praekeltorg/alpine-python:2.7-onbuild\ndocker tag praekeltorg/alpine-python:onbuild registry:5000/praekeltorg/alpine-python:2-onbuild\ndocker tag praekeltorg/alpine-python:onbuild registry:5000/praekeltorg/alpine-python:onbuild\ndocker push registry:5000/praekeltorg/alpine-python:2.7.13\ndocker push registry:5000/praekeltorg/alpine-python:2.7\ndocker push registry:5000/praekeltorg/alpine-python:2\ndocker push registry:5000/praekeltorg/alpine-python:latest\ndocker push registry:5000/praekeltorg/alpine-python:2.7.13-onbuild\ndocker push registry:5000/praekeltorg/alpine-python:2.7-onbuild\ndocker push registry:5000/praekeltorg/alpine-python:2-onbuild\ndocker push registry:5000/praekeltorg/alpine-python:onbuild\n```\n\nIf you want to make your commands even shorter, the `docker-ci-deploy` command is also available as just `dcd`, and most options have a short form:\n```\n\u003e $ dcd -V 3.6.0 -S -L -r registry:5000 --dry-run alpine-python\n\ndocker tag alpine-python registry:5000/alpine-python:3.6.0\ndocker tag alpine-python registry:5000/alpine-python:3.6\ndocker tag alpine-python registry:5000/alpine-python:3\ndocker tag alpine-python registry:5000/alpine-python:latest\ndocker push registry:5000/alpine-python:3.6.0\ndocker push registry:5000/alpine-python:3.6\ndocker push registry:5000/alpine-python:3\ndocker push registry:5000/alpine-python:latest\n```\n\nUse the `-h`/`--help` option to see all available options.\n\n## Installation\n```\npip install docker-ci-deploy==0.2.0\n```\n\nThe script is self-contained and has no dependencies. It can be run by simply executing the [main file](docker-ci-deploy/__main__.py).\n\n## Usage\nThe script can tag an existing image and push the new tags to a registry.\n\nThere is one required argument: the image to push.\n\n#### Pushing an image\n```\ndocker-ci-deploy my-image:latest\n```\n\nThis will simply push the image `my-image:latest` to the default registry (https://hub.docker.com).\n\n#### Tagging\n```\ndocker-ci-deploy --tag alpine --tag $(git rev-parse --short HEAD) my-image:latest\n\n```\nThis will result in the tags `my-image:alpine` and `my-image:eea981f` (for example) being created and pushed (**Note:** the original tag `my-image:latest` is _not_ pushed).\n\n#### Version tags\n```\ndocker-ci-deploy --tag alpine --version 1.2.3 my-image\n```\nThis will result in the tag `my-image:1.2.3-alpine` being created and pushed. If a version is already present in the start of a tag, it will not be added. For example, in the above example if `--tag 1.2.3-alpine` were provided, the image would still be tagged with `1.2.3-alpine`, not `1.2.3-1.2.3-alpine`.\n\nYou can also push the tags without the version information so that they are considered the \"latest\" tag:\n```\ndocker-ci-deploy --version 1.2.3 --version-latest my-image\n```\nThis will result in the tags `my-image:1.2.3` and `my-image:latest` being pushed.\n\n\u003e NOTE: The `--version` and `--version-latest` options used to be known as `--tag-version` and `--tag-latest`, respectively. These old option names will continue working for the current release but will be removed soon.\n\n#### Semantic version tags\n```\ndocker-ci-deploy --tag alpine --version 1.2.3 --version-semver my-image\n```\nThis will result in the tags `my-image:1.2.3-alpine`, `my-image:1.2-alpine`, and `my-image:1-alpine` being created and pushed. If part of the version is already present in the start of a tag, it will not be added. For example, in the above example if `--tag 1.2-alpine` were provided, the image would still be tagged with `1.2.3-alpine`, not `1.2.3-1.2-alpine`.\n\nThis works by stripping pieces from the front of the version string using the regex `[.-]?\\w+$`. This means that version strings with some text in them are also supported. For example, a tag such as `8.7.1-jessie` will produce the tags/tag prefixes `8.7.1-jessie`, `8.7.1`, `8.7`, and `8`.\n\nAn optional \"precision\" value can be set using the `--semver-precision` option. This sets the minimum precision of the generated versions. For example, by passing `--version 1.2.3 --version-semver --semver-precision 2`, the versions `1.2.3` and `1.2` are generated but *not* `1`.\n\nNote that this will **not** tag a version `0` unless the `--semver-zero` option is also used.\n\nThis can be used in combination with `--version-latest`.\n\n\u003e NOTE: The `--version-semver` option used to be known as `--tag-version`. This old option name will continue working for the current release but will be removed soon.\n\n#### Custom registry\n```\ndocker-ci-deploy \\\n  --tag alpine --tag $(git rev-parse --short HEAD) \\\n  --registry my-registry.example.com:5000 \\\n  my-image:latest\n```\nThis will result in the tags `my-registry.example.com:5000/my-image:alpine` and `my-registry.example.com:5000/my-image:eea981f` being created and pushed.\n\n**NOTE:** The reference grammar for Docker image tags (as of Docker 1.13.0) is not strict enough to distinguish between a registry address and an image name component in all cases. For example, the tag `praekeltorg/alpine-python` could refer to the image with name `alpine-python` stored in the registry with hostname `praekeltorg` *or* it could be an image called `praekeltorg/alpine-python` stored in the default registry. `docker-ci-deploy` will first just prepend the registry address to the tag and only attempt to remove an existing registry address from the tag if the new tag is invalid.\n\n#### Multiple images\nYou can provide multiple images to `docker-ci-deploy` and it will tag and push all of them:\n```\ndocker-ci-deploy --tag $(git rev-parse --short HEAD) my-image my-other-image\n```\nThis will result in the tags `my-image:eea981f` and `my-other-image:eea981f` being created and pushed.\n\n#### Debugging\nUse the `--dry-run` and `--verbose` parameters to see what the script will do before you use it. For more help try `docker-ci-deploy --help`.\n\n## Travis CI\nThe script could be used in any CI service that provides access to the standard Docker CLI but was developed with Travis in mind.\n\nFor Travis CI this config should get you started pushing images to Docker Hub:\n```yaml\nservices: docker\nlanguage: python\nenv:\n  global:\n    - DOCKER_USER=janedoe\n    - secret: \u003cencrypted\u003e # DOCKER_PASS=pa$$word\n\nbefore_install:\n  - pip install docker-ci-deploy\n\nscript:\n  - docker build -t janedoe/my-image .\n\nbefore_deploy:\n  - docker login -u \"$DOCKER_USER\" -p \"$DOCKER_PASS\"\ndeploy:\n  provider: script\n  script: docker-ci-deploy --tag $(git rev-parse --short HEAD) --tag latest janedoe/my-image\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraekeltfoundation%2Fdocker-ci-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpraekeltfoundation%2Fdocker-ci-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraekeltfoundation%2Fdocker-ci-deploy/lists"}