I wrote this because docker hub is stupid. Or at least seems that way.
Longer explanation:
Dockerhub limits the number of groups that can be seen in their web UI. There is no way, for example, to see more than n groups should you have that many (n being a number around 110). For that reason, any groups > 110 are completely unmanagable from the web UI.
This script is written for mozilla's use (specifically the mozilla-services) group. YMMV, but it should be quite adaptable to anyone else's needs.
- Create virtualenv (or whatever you prefer for I-downloaded-it-from-the-internet code)
- Activate your venv
- cd <checkout dir>
- run
pip install .
-
Export your dockerhub username/password as the ENV vars DH_USERNAME and DH_PASSWORD. The script will not run without this.
-
Sample uses:
$ ./dockhub.py --action add --dh_user <dockerhub username> --dh_repo <dockerhub repo name> --dh_group <dockerhub group>
Add <dockerhub username> to the <dockerhub group> and then grant that group r+w permissions to <dockerhub repo name>
$./dockhub.py --action list --dh_repo <repo name>
Display group membership and permissions for <repo name>
$./dockhub.py --action add --dh_user <user name> --dh_group <group name>
Add <user name> to <group name>
Finally, you can also remove users from groups
# ./dockhub.py --action remove --dh_user <user name> --dh_group \<group name\>
Removes <user name> from <group name>
-
Install dev requirements:
$ pip install -r requirements-dev.txt
-
Run tests:
$ pytest