How do I pull images in Kubernetes or push from CI?
Use a read-only token for clusters and servers, and a read/write token for your CI. Create them on the registry’s Access tokens tab. See How do I create and manage access tokens?
Kubernetes: a pull secret
Section titled “Kubernetes: a pull secret”Create the secret with a read-only token:
kubectl create secret docker-registry phluit-registry \ --docker-server=cr.phluit.net \ --docker-username='robot$<your-registry>+<token-name>' \ --docker-password='<your-token>'Then use it in your pod spec, and point the container’s image at cr.phluit.net/<your-registry>/<image>:<tag>:
imagePullSecrets: - name: phluit-registryCreate the secret in each namespace that pulls from the registry.
GitHub Actions
Section titled “GitHub Actions”In your repository, add two secrets: PHLUIT_REGISTRY_USER (the token’s user name) and PHLUIT_REGISTRY_TOKEN (the token). Then add these steps to your workflow:
- uses: docker/login-action@v3 with: registry: cr.phluit.net username: ${{ secrets.PHLUIT_REGISTRY_USER }} password: ${{ secrets.PHLUIT_REGISTRY_TOKEN }}- run: docker build -t cr.phluit.net/<your-registry>/my-app:${{ github.sha }} . && docker push cr.phluit.net/<your-registry>/my-app:${{ github.sha }}Your registry’s Overview tab shows the same steps with your address under GitHub Actions.
Other CI systems (GitLab CI and others)
Section titled “Other CI systems (GitLab CI and others)”Keep the user name and token as protected CI variables, then:
echo "$PHLUIT_TOKEN" | docker login cr.phluit.net -u "$PHLUIT_USER" --password-stdindocker build -t cr.phluit.net/<your-registry>/app:$COMMIT .docker push cr.phluit.net/<your-registry>/app:$COMMITPhluit servers
Section titled “Phluit servers”On a Phluit cloud server, log in with a read-only token and pull or run the image:
docker login cr.phluit.net -u 'robot$<your-registry>+<token-name>' --password-stdin < token.txtdocker run -d cr.phluit.net/<your-registry>/app:1.0Good to know
Section titled “Good to know”- Tag images with the commit or a version number, not only
latest, so you know what runs where. - A token with an expiry date stops working on that date. Create the new token and update your secrets before then.
- Old tags take space. See How do I see scan results and delete old images?
Was this helpful?
Thank you. If something is missing, tell us.
