Dockerhub
This page provides a step-by-step guide on configuring and deploying a Docker image from Docker Hub. It covers essential prerequisites, Docker Hub configuration, deployment settings, and testing.
Last updated
This page provides a step-by-step guide on configuring and deploying a Docker image from Docker Hub. It covers essential prerequisites, Docker Hub configuration, deployment settings, and testing.
Last updated
A Docker Account: Sign up for a free Docker account at .
Docker Desktop: Download and install Docker Desktop for your operating system from .
A Docker Image: Have your Docker image already built and pushed to a Docker Hub repository. You can find resources for building Docker images in the Docker documentation:
Docker Hub Repository: Create a repository on Docker Hub to store your image. You can do this through your Docker account dashboard.
Docker Hub Credentials: You'll need either your Docker Hub username and password or a personal access token to authenticate and pull the image from a private repository. You can create a personal access token in your Docker account settings.
Docker Pull Secret: This is not mandatory for public repositories, but recommended for private repositories to securely store your credentials.
Create a Personal Access Token:
Log in to your Docker Hub account.
Go to your account settings.
Under "Security," click on "Personal access tokens."
Create a new token, specifying the necessary scopes (e.g., "read:org," "read:repo," "pull:registry").
Copy the generated token.
Use the Token as a Secret:
In your deployment configuration, use the personal access token as the value for the "Password" field.
Ensure that the secret is stored securely to prevent unauthorized access.
If you prefer to use a Docker Hub username and password directly, you can:
Create a Docker Hub Pull Secret:
Use the docker secret create
command in your terminal or command prompt.
Specify a secret name and provide your username and password as base64-encoded values.
Example:
Note: Using a personal access token is generally considered more secure as it allows you to limit the scope of permissions granted to the token.
Deployment Name: Provide a unique name for your deployment.
Docker Repo/Registry URL:
Enter the URL of your Docker Hub repository. For Docker Hub, this usually follows the format:
docker.io/username/repo-name
.
Image Tag:
Enter the image tag (e.g., latest
, or any specific version tag of your image).
If your Docker Hub repository is private, toggle the Private Registry option to enable pulling from a private Docker Hub repository.
Select Secret: Choose Docker Hub from the dropdown under the "Select Secret" option.
Add New Secret: If no Docker Hub credentials are stored yet, click Add new and perform the following:
Registry Provider: Select Docker Hub.
Secret Name: Provide a custom name for the secret (e.g., DockerHub_Pull_Secret
).
Repo URL: Enter your Docker Hub repository URL.
Username: Enter your Docker Hub username.
Email: Enter your email associated with the Docker Hub account.
Password: Provide your Docker Hub password or personal access token.
Submit Secret: Once the secret is filled, click Submit to add the Docker Hub pull secret
Test Connection: After the secrets are configured, click Test to verify the connection with your Docker Hub repository.
Registry Provider Selection: Select Docker Hub as the Registry Provider from the list.
Repo URL, Username, Email, Password: Confirm and re-enter the following details if necessary:
Repo URL (your Docker Hub repository URL)
Username: Your Docker Hub username
Email: Your Docker Hub account email
Password: Your Docker Hub password or token
Continue: If the test is successful, click Continue to finalize the Docker image configuration.
Once the Docker image is successfully configured, proceed to the deployment settings.
Configure Deployment Details:
Port Mapping: Define the ports required for your application.
Command and Arguments: Set custom Docker commands and arguments (if any) to run when the container starts.
Environment Variables: Specify any environment variables needed for the container's runtime.
Pricing/Resource Allocation: Configure the resource allocation (e.g., CPU, RAM) and select a pricing tier that suits your deployment.
Once all configurations are in place, click Deploy to launch your containerized application from Docker Hub. The system will now pull the Docker image from Docker Hub (public or private based on the repository) and deploy it.
By following these steps, you have successfully configured a Docker image from Docker Hub and deployed it. After reviewing your deployment setup, you are now able to run your containerized application smoothly on the selected infrastructure, with a simple and user-friendly experience for developers at all levels.