Use DockerHub for pipeline integration
Configure Docker Hub as a Docker registry for CI pipelines to push images to it.
- Select Docker Hub as the registry provider.
- Define the following:
- Registry Name: A unique name for this configuration.
- Username: Docker Hub username.
- Password: Docker Hub personal account token, or Dockerhub account password (not recommended).
If you have enabled two-factor-authentication in Docker Hub, then in the Password field, paste a Docker personal access token (instead of your Docker Hub master password). Otherwise, Codefresh will not be able to push your image.
If you don’t have 2FA enabled in Dockerhub, then you can also use your Dockerhub account password. But in all cases we suggest you create a personal access token for Codefresh (personal access tokens are more secure as you can revoke them on demand and see when they were last used).
Docker.io only allows you to push images that are tagged with your username.
If you have a choice, create a Docker Hub account with the same username that you have in Codefresh.
If not, you need to change the Docker image created to match your username in every push step.
Adding more Docker Hub integrations
You can add additional Docker Hub accounts using the same process.
You can specify which registry will be used as primary/default for the
Use the appropriate
registry name value in your pipelines in order to decide which Dockerhub account will be used.
Here is a pipeline that pushes to two different Docker Hub accounts:
This is the definition for the pipeline:
The two Dockerhub accounts are
kostiscodefresh, and Codefresh automatically uses the correct integration by looking at the
image_name property of the push step.