Feature request: Choose public or private visibility when pushing a new repository to Docker Hub
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
Piste de recherche
Start with the related discussion in issue #4977 and review Docker Hub’s repository creation API, especially its is_private field. The payload names no CLI files or tests, so first locate the docker push command and its registry handling. Done means new Docker Hub repositories use the requested visibility before upload, mismatches and failures stop the push, and other registries are clearly handled.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Description
When running docker push for a Docker Hub repository that does not yet exist, Docker Hub creates it using the namespace's default repository visibility.
If that default is public, a user intending to upload a private image can accidentally publish it. The CLI does not offer a public/private selection before uploading.
I would like an option to explicitly select the intended visibility when pushing to a new Docker Hub repository.
Steps illustrating the current behavior
-
Use a Docker Hub namespace whose default repository visibility is Public.
-
Tag a local image with a repository name that does not exist:
docker tag myapp:latest <username>/new-repository:latest -
Push the image:
docker push <username>/new-repository:latest -
Check the newly created repository's visibility in Docker Hub.
The repository is created as public according to the namespace default, without a visibility selection in the CLI.
Proposed behavior
Allow users to explicitly select visibility before the first upload. For example, the following is proposed syntax, not an existing option:
docker push --visibility private <username>/new-repository:latest
docker push --visibility public <username>/new-repository:latest
An optional interactive mode could offer:
Choose visibility for the new Docker Hub repository:
> Private
Public
Automation should be able to use the explicit flag without any interactive prompt. Existing command behavior should remain unchanged when the feature is not requested.
Expected safeguards
- Create a missing repository with the requested visibility before uploading any image content.
- Verify the repository's visibility before pushing, and stop if verification or creation fails, including permission or private-repository quota errors.
- For an existing repository, report a visibility mismatch rather than silently changing its visibility.
- Clearly report unsupported registries if this functionality is specific to Docker Hub.
Implementation consideration
Repository visibility is managed by Docker Hub rather than the standard image-push protocol. This may require Docker Hub API integration or a dedicated CLI plugin. A check before uploading also cannot prevent another authorized actor from changing repository visibility concurrently or afterward.
References and related discussion
- Docker Hub default privacy settings: https://docs.docker.com/docker-hub/settings/
- Docker Hub repository creation API, including
is_private: https://docs.docker.com/reference/api/hub/latest/operations/CreateRepository/ - Related feature request: https://github.com/docker/cli/issues/4977
This request overlaps with #4977; I am linking it to preserve the existing discussion and implementation constraints.
- Langage dominant
- Go
- Étoiles
- 6.1k
- Forks
- 2.2k
- Merge moyen
- 1 j 8 h
- PR mergées (30 j)
- 62
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de docker/cli
-
Mode option in tmpfs volume is ignored when deployed via docker stack deployPeut-être pris @locker95 l’a pris il y a 15 jours. Ouvertekind/bug status/0-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
docker stack: text after an unbraced `$VAR` is dropped when it starts with `-`, `:-`, `?` or `:?`Peut-être pris @sebxt l’a pris il y a 28 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 87/100
Les mainteneurs répondent en général sous 1 jour
-
filename completion on `docker load -i`Peut-être pris @cra l’a pris il y a 31 jours. Ouvertekind/feature status/0-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
docker build treats uppercase HTTP(S) URLs as local pathsPeut-être pris @TanvirTian l’a pris il y a 38 jours. Ouvertekind/bug status/0-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
`docker context export` writes a truncated tar archivePeut-être pris @2arian3 l’a pris il y a 54 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 92/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de docker/cli
Issues similaires
-
agent-review-finding chore
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
jordansmall/spindrift#7254 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
pg-sharding/spqr#3275 ·
Les mainteneurs répondent en général sous 1 jour
-
create_or_update_file rejects explicitly empty file contentPeut-être pris @Elon-Jiang l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
github/github-mcp-server#3883 ·
Les mainteneurs répondent en général sous 4 jours
-
feature
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
databricks/terraform-provider-databricks#6210 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
IBM-Cloud/terraform-provider-ibm#7115 ·
Les mainteneurs répondent en général sous 2 jours