Configurer Docker pour qu'il fasse confiance à l'autorité de certification racine Harbor
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Les instances Harbor utilisent des certificats TLS (Transport Layer Security) émis par l'autorité de certification (CA) racine de confiance de votre organisation. Cela chiffre la connexion entre votre client Docker et le registre Harbor pour sécuriser les images contre tout accès non autorisé.
Avant de commencer
Vous devez effectuer les étapes suivantes avant de gérer vos images de conteneur :
Docker nécessite un accès privilégié pour interagir avec les registres. Sous Linux ou Windows, ajoutez l'utilisateur que vous permet d'exécuter des commandes Docker dans le groupe de sécurité Docker. Cette étape n'est pas requise sous macOS, car Docker Desktop s'exécute sur une machine virtuelle en tant qu'utilisateur racine.
Pour Linux, ajoutez l'utilisateur :
sudousermod-a-GdockerUSER
Pour Windows :
netlocalgroupdocker-usersDOMAIN\USER/add
Remplacez USER par le nom d'utilisateur que vous souhaitez ajouter.
Configurer Docker pour qu'il fasse confiance à l'autorité de certification racine Harbor
Vous devez configurer votre client Docker local pour qu'il fasse confiance à l'autorité de certification racine de votre organisation lorsque vous utilisez le client Docker pour communiquer avec l'instance Harbor.
Pour configurer le client Docker afin qu'il fasse confiance à l'autorité de certification racine, demandez le fichier .crt de l'autorité de certification racine à l'administrateur de votre organisation, puis copiez l'autorité de certification racine de l'organisation dans :
/etc/docker/certs.d/HARBOR_INSTANCE_URL/ca.crt
Remplacez HARBOR_INSTANCE_URL par l'URL de votre instance Harbor. Exemple : harbor-1.org-1.zone1.google.gdc.test.
Cette commande permet à votre client Docker d'établir une connexion HTTPS avec l'instance Harbor.
Vous pouvez également utiliser la CLI gdcloud pour vous connecter à n'importe quel cluster d'utilisateur de l'organisation et copier l'autorité de certification Web enregistrée dans le cluster :
Remplacez HARBOR_INSTANCE_URL par l'URL de votre instance Harbor. Exemple : harbor-1.org-1.zone1.google.gdc.test.
Si la configuration échoue, le message d'erreur suivant s'affiche :
Error response from daemon: Get "https://<HARBOR_INSTANCE_URL>": x509: certificate signed by unknown authority
Répétez les étapes pour résoudre ce problème et escaladez-le à l'équipe d'ingénieurs GDC si nécessaire.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eHarbor instances use TLS certificates from your organization's root CA to encrypt connections and secure images from unauthorized access.\u003c/p\u003e\n"],["\u003cp\u003eBefore interacting with container images, ensure Docker is installed and that the user running Docker commands is added to the Docker security group on Linux or Windows systems.\u003c/p\u003e\n"],["\u003cp\u003eTo enable secure communication, configure your Docker client to trust your organization's root CA by copying the CA's \u003ccode\u003e.crt\u003c/code\u003e file to \u003ccode\u003e/etc/docker/certs.d/<HARBOR_INSTANCE_URL>/ca.crt\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eAlternatively, you can use the \u003ccode\u003egdcloud CLI\u003c/code\u003e to sign in to the user cluster and then copy the web CA that is saved in the cluster.\u003c/p\u003e\n"],["\u003cp\u003eAn error message stating the "certificate signed by unknown authority" indicates that the configuration to trust the CA was not successful.\u003c/p\u003e\n"]]],[],null,["# Configure Docker to trust the Harbor root CA\n\nHarbor instances use Transport Layer Security (TLS) certificates issued by your\norganization's trusted root Certificate Authority (CA). This encrypts the\nconnection between your Docker client and Harbor registry to secure images from\nunauthorized access.\n\nBefore you begin\n----------------\n\nYou must perform these steps before managing your container\nimages:\n\n1. Install Docker if it is not already installed by following the instructions at \u003chttps://docs.docker.com/engine/install/ubuntu/\u003e. Docker is included in Cloud Shell.\n2. Docker requires privileged access to interact with registries. On Linux\n or Windows, add the user that you use to run Docker commands to the Docker\n security group. This step is not required on macOS since Docker Desktop\n runs on a virtual machine as the root user.\n\n 1. For Linux, add the user:\n\n sudo usermod -a -G docker \u003cvar translate=\"no\"\u003eUSER\u003c/var\u003e\n\n 2. For Windows:\n\n net localgroup docker-users DOMAIN\\\u003cvar translate=\"no\"\u003eU\u003c/var\u003eSER /add\n\n Replace \u003cvar translate=\"no\"\u003eUSER\u003c/var\u003e with the username you want to add.\n\nConfigure Docker to trust Harbor Root CA\n----------------------------------------\n\nYou must configure your local Docker client to trust your organization's root\nCA when using the Docker client to communicate with the Harbor instance.\n\nTo configure the Docker client to trust the root CA, request the `.crt` file of\nthe root CA from your organization administrator, and copy the organization root\nCA to: \n\n /etc/docker/certs.d/\u003cvar translate=\"no\"\u003eHARBOR_INSTANCE_URL\u003c/var\u003e/ca.crt\n\nReplace \u003cvar translate=\"no\"\u003eHARBOR_INSTANCE_URL\u003c/var\u003e with the URL of your Harbor instance. For\nexample, `harbor-1.org-1.zone1.google.gdc.test`.\n\nThis command allows your Docker client to establish a HTTPS connection with the Harbor\ninstance.\n\nAlternatively, use the gdcloud CLI to sign in to any user cluster in the organization,\nand copy the web CA saved in the cluster: \n\n export REGISTRY=\u003cvar translate=\"no\"\u003eHARBOR_INSTANCE_URL\u003c/var\u003e\n mkdir -p /etc/docker/certs.d/${REGISTRY} && \\echo $(kubectl get secret org-web-ca -n istio-system -o\n jsonpath='{.data.ca\\.crt}') | openssl base64 -A -d \u003e\n /etc/docker/certs.d/${REGISTRY}/ca.crt\n\nReplace \u003cvar translate=\"no\"\u003eHARBOR_INSTANCE_URL\u003c/var\u003e with the URL of your Harbor instance. For\nexample, `harbor-1.org-1.zone1.google.gdc.test`.\n\nIf the configuration is unsuccessful, you see the following error message: \n\n Error response from daemon: Get \"https://\u003cHARBOR_INSTANCE_URL\u003e\": x509: certificate signed by unknown authority\n\nRepeat the steps to solve this issue, and escalate to GDC engineering if\nnecessary."]]