move-off-dockerhub


Namemove-off-dockerhub JSON
Version 1.0 PyPI version JSON
download
home_page
SummaryA simple commandline utility to copy many tags (regex filtered) of a docker image from one registry to another
upload_time2023-10-20 11:24:37
maintainer
docs_urlNone
author
requires_python
license
keywords docker
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # move-off-dockerhub

A simple commandline utility to copy many tags (regex filtered) of a docker image from one registry to another

## Why?

When you wanna move off [DockerHub](https://hub.docker.com) to another docker registry
that hasn't kicked you off yet (such as [quay.io](https://quay.io)), you ideally wanna
bring at least *some* of your old images over. This way, if any of your end users are
throttled by DockerHub, you can tell them 'hey just point to the same image on quay.io
instead, and it will continue to work until IBM enshittifies it!'. This small application
lets you copy a subset of tags from your old registry to new by filtering with a regex!

## Installation

You can install this from PyPI:

```bash
pip install move-off-dockerhub
```

You also need [skopeo](https://github.com/containers/skopeo/blob/main/install.md) installed.
Fairly easy, it's packaged well for most distributions / on homebrew.

## Usage

### Login to the docker registries

It's best if you login to both the source and destination docker registries, so you
aren't throttled at the source and have ability to push to the destination. You can
do so with [`skopeo login`](https://github.com/containers/skopeo/blob/main/docs/skopeo-login.1.md).

```bash
# Login to DockerHub
$ skopeo login docker.io
Username: <enter-username>
Password: <enter-password>
Login Succeeded!
$ skopeo login quay.io
Username: <enter-username>
Password: <enter-password>
Login Succeeded!
```

### Do a dry run to figure out which tags to copy

You can now do a dry run to look at the list of tags, and filter out which ones you
wanna copy.

I'm going to use `jupyterhub/k8s-hub` on dockerhub as the example. It gets a tag
pushed for each commit to [zero-to-jupyterhub-on-k8s](https://z2jh.jupyter.org)
that touches the hub. But we only want to copy over the images for the released
versions.

```bash
$ move-off-dockerhub jupyterhub/k8s-hub quay.io/jupyterhub/k8s-hub '.*' --dry-run
<list-of-551-tags>
```

The first argument is the source image, second is the destination (ignored right now),
and the third is a (quoted) regex that tags must match to be copied. The `--dry-run`
shows just the list of tags that would be copied but doesn't actually copy. In this case, we
specify `.*` so we can just look at all the tags, sacrifice a goat to the professor
and construct a regular expression that lists just the tags we want.

After some trial and sacrifice, we find the perfect readable incantation that
gives us all the tags we want

```bash
$ move-off-dockerhub jupyterhub/k8s-hub quay.io/jupyterhub/k8s-hub 'v?\d+\.\d+\.?\d*$' --dry-run
Copying the following tags:
0.10.0
0.10.1
0.10.2
0.10.3
0.10.4
0.10.5
0.10.6
0.11.0
0.11.1
0.7.0
0.8.0
0.8.1
0.8.2
0.9.0
0.9.1
1.0.0
1.0.1
1.1.0
1.1.1
1.1.2
1.1.3
1.1.4
1.2.0
2.0.0
3.0.0
3.0.1
3.0.2
3.0.3
3.1.0
v0.1
v0.3.1
v0.4
v0.5.0
v0.6
```

`v?\d+\.\d+\.\d*$` looks for tags that optionally have a `v` up front (because
some releases did), and then three numbers (of any length) separated by a dot, with
the last number being optional. Making this regex took a lot of sacrifice on behalf
of these electrons, I hope you appreciate them.

### Actually do the copy

First, make sure you have a good internet connection. If you have a friend trying
to watch the cricket worldcup on the same internet connection as you while you do
this, you gonna have a fight. Don't do it.

When the coast is clear, run the same command but without `--dry-run`.

```
$ move-off-dockerhub jupyterhub/k8s-hub quay.io/jupyterhub/k8s-hub 'v?\d+\.\d+\.?\d*$' --dry-run
<lots--of-information-you-don't-need-will-be-output-and-inside-it-will-be-some-info-you-want>
```

Now just wander around, drink some coffee, feed some cats, try to figure out what
you are going to write in the release notes, what the point of venture capital is, etc
as the images copy over.

If your source images are multiarch, all the available architectures will be copied over.

If you run the script again, previously copied tags will still attempt to be copied
but probably go by real quick. `skopeo` is built by some smart people so I just assume
they do something smart and have not actually verified this.

## Why is it called that?

I didn't get enough sleep last night, so my brain could not think of a better name.
NOW YOU ARE STUCK WITH IT HAHA.

If you want this to be a different name, I'm open to suggestions but only from people
who have not posted on Twitter in the last 3 months.

## Why is it AGPL?

As a child, I started writing code that others found useful 'for fun'. As an
adult, I'm very privileged to be able to write code for causes I care about, in
community with people who treat me well, *and* get paid for it! This is awesome!
In therapy, we have discovered it is still quite important to do things
'just for fun'. Writing code that's not actually useful to anyone doesn't feel like 'fun'
to me, but I also wanted to experience the feeling of 'hey, something new!'.

Now, this project was created definitely very much for the benefit of the Jupyter Project.
Given the commandline nature of this project, it should have 0 actual impact on any users. But maybe
the newness of it will give me a dopamine hit!?! We'll find out.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "move-off-dockerhub",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "docker",
    "author": "",
    "author_email": "YuviPanda <yuvipanda@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/12/b0/bb7acade1bb7515e004105c825f1efb45462f42220b10122ae0ade1496ed/move-off-dockerhub-1.0.tar.gz",
    "platform": null,
    "description": "# move-off-dockerhub\n\nA simple commandline utility to copy many tags (regex filtered) of a docker image from one registry to another\n\n## Why?\n\nWhen you wanna move off [DockerHub](https://hub.docker.com) to another docker registry\nthat hasn't kicked you off yet (such as [quay.io](https://quay.io)), you ideally wanna\nbring at least *some* of your old images over. This way, if any of your end users are\nthrottled by DockerHub, you can tell them 'hey just point to the same image on quay.io\ninstead, and it will continue to work until IBM enshittifies it!'. This small application\nlets you copy a subset of tags from your old registry to new by filtering with a regex!\n\n## Installation\n\nYou can install this from PyPI:\n\n```bash\npip install move-off-dockerhub\n```\n\nYou also need [skopeo](https://github.com/containers/skopeo/blob/main/install.md) installed.\nFairly easy, it's packaged well for most distributions / on homebrew.\n\n## Usage\n\n### Login to the docker registries\n\nIt's best if you login to both the source and destination docker registries, so you\naren't throttled at the source and have ability to push to the destination. You can\ndo so with [`skopeo login`](https://github.com/containers/skopeo/blob/main/docs/skopeo-login.1.md).\n\n```bash\n# Login to DockerHub\n$ skopeo login docker.io\nUsername: <enter-username>\nPassword: <enter-password>\nLogin Succeeded!\n$ skopeo login quay.io\nUsername: <enter-username>\nPassword: <enter-password>\nLogin Succeeded!\n```\n\n### Do a dry run to figure out which tags to copy\n\nYou can now do a dry run to look at the list of tags, and filter out which ones you\nwanna copy.\n\nI'm going to use `jupyterhub/k8s-hub` on dockerhub as the example. It gets a tag\npushed for each commit to [zero-to-jupyterhub-on-k8s](https://z2jh.jupyter.org)\nthat touches the hub. But we only want to copy over the images for the released\nversions.\n\n```bash\n$ move-off-dockerhub jupyterhub/k8s-hub quay.io/jupyterhub/k8s-hub '.*' --dry-run\n<list-of-551-tags>\n```\n\nThe first argument is the source image, second is the destination (ignored right now),\nand the third is a (quoted) regex that tags must match to be copied. The `--dry-run`\nshows just the list of tags that would be copied but doesn't actually copy. In this case, we\nspecify `.*` so we can just look at all the tags, sacrifice a goat to the professor\nand construct a regular expression that lists just the tags we want.\n\nAfter some trial and sacrifice, we find the perfect readable incantation that\ngives us all the tags we want\n\n```bash\n$ move-off-dockerhub jupyterhub/k8s-hub quay.io/jupyterhub/k8s-hub 'v?\\d+\\.\\d+\\.?\\d*$' --dry-run\nCopying the following tags:\n0.10.0\n0.10.1\n0.10.2\n0.10.3\n0.10.4\n0.10.5\n0.10.6\n0.11.0\n0.11.1\n0.7.0\n0.8.0\n0.8.1\n0.8.2\n0.9.0\n0.9.1\n1.0.0\n1.0.1\n1.1.0\n1.1.1\n1.1.2\n1.1.3\n1.1.4\n1.2.0\n2.0.0\n3.0.0\n3.0.1\n3.0.2\n3.0.3\n3.1.0\nv0.1\nv0.3.1\nv0.4\nv0.5.0\nv0.6\n```\n\n`v?\\d+\\.\\d+\\.\\d*$` looks for tags that optionally have a `v` up front (because\nsome releases did), and then three numbers (of any length) separated by a dot, with\nthe last number being optional. Making this regex took a lot of sacrifice on behalf\nof these electrons, I hope you appreciate them.\n\n### Actually do the copy\n\nFirst, make sure you have a good internet connection. If you have a friend trying\nto watch the cricket worldcup on the same internet connection as you while you do\nthis, you gonna have a fight. Don't do it.\n\nWhen the coast is clear, run the same command but without `--dry-run`.\n\n```\n$ move-off-dockerhub jupyterhub/k8s-hub quay.io/jupyterhub/k8s-hub 'v?\\d+\\.\\d+\\.?\\d*$' --dry-run\n<lots--of-information-you-don't-need-will-be-output-and-inside-it-will-be-some-info-you-want>\n```\n\nNow just wander around, drink some coffee, feed some cats, try to figure out what\nyou are going to write in the release notes, what the point of venture capital is, etc\nas the images copy over.\n\nIf your source images are multiarch, all the available architectures will be copied over.\n\nIf you run the script again, previously copied tags will still attempt to be copied\nbut probably go by real quick. `skopeo` is built by some smart people so I just assume\nthey do something smart and have not actually verified this.\n\n## Why is it called that?\n\nI didn't get enough sleep last night, so my brain could not think of a better name.\nNOW YOU ARE STUCK WITH IT HAHA.\n\nIf you want this to be a different name, I'm open to suggestions but only from people\nwho have not posted on Twitter in the last 3 months.\n\n## Why is it AGPL?\n\nAs a child, I started writing code that others found useful 'for fun'. As an\nadult, I'm very privileged to be able to write code for causes I care about, in\ncommunity with people who treat me well, *and* get paid for it! This is awesome!\nIn therapy, we have discovered it is still quite important to do things\n'just for fun'. Writing code that's not actually useful to anyone doesn't feel like 'fun'\nto me, but I also wanted to experience the feeling of 'hey, something new!'.\n\nNow, this project was created definitely very much for the benefit of the Jupyter Project.\nGiven the commandline nature of this project, it should have 0 actual impact on any users. But maybe\nthe newness of it will give me a dopamine hit!?! We'll find out.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A simple commandline utility to copy many tags (regex filtered) of a docker image from one registry to another",
    "version": "1.0",
    "project_urls": null,
    "split_keywords": [
        "docker"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9afa2d477d2240b6f74ee0c23108f04884f33f506b84e7dcfb166a3f2fcc4fd6",
                "md5": "3dc336f4cef7d7ab6e1299caaa16d14d",
                "sha256": "566171d5c2f1ec70c459adb8130a896e142fc763de9cfee05d2aa3e39b83b37c"
            },
            "downloads": -1,
            "filename": "move_off_dockerhub-1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3dc336f4cef7d7ab6e1299caaa16d14d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 16740,
            "upload_time": "2023-10-20T11:24:36",
            "upload_time_iso_8601": "2023-10-20T11:24:36.126511Z",
            "url": "https://files.pythonhosted.org/packages/9a/fa/2d477d2240b6f74ee0c23108f04884f33f506b84e7dcfb166a3f2fcc4fd6/move_off_dockerhub-1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "12b0bb7acade1bb7515e004105c825f1efb45462f42220b10122ae0ade1496ed",
                "md5": "f84b4a5ce81249b21a46ad6078d59b71",
                "sha256": "d09919d7eeb00bb4f6648b6c9b807d0dbab60341b51880a812b1d495d56385fa"
            },
            "downloads": -1,
            "filename": "move-off-dockerhub-1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f84b4a5ce81249b21a46ad6078d59b71",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 16170,
            "upload_time": "2023-10-20T11:24:37",
            "upload_time_iso_8601": "2023-10-20T11:24:37.543683Z",
            "url": "https://files.pythonhosted.org/packages/12/b0/bb7acade1bb7515e004105c825f1efb45462f42220b10122ae0ade1496ed/move-off-dockerhub-1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-20 11:24:37",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "move-off-dockerhub"
}
        
Elapsed time: 0.13121s