Push and Pull Nexus Repository
To push and pull artifacts from a Nexus repository, specifically a Docker Host Repository, follow these steps:
Step 1: Create a Docker Host Repository
1. Create a Docker Host Repository in Nexus to store your Docker images.
Step 2: Create a Role and Assign Privileges
1. Create a role with the necessary privileges (e.g., nx-docker).
2. Assign the role to the user you created.
Roles: Goto Roles-> Create Role-> Enter the details (Role ID, Role Name,) and at the end assigned Privileges to the Role.
Now we go to the Users tab and assigned the Role to the user (nx-docker is the role we created here)
Step 3: Assign a Port Number to the Docker Host Repository
1. Configure connectors to allow Docker clients to connect to the hosted registry.
2. Assign a specific port number to your Docker Host Repository.
Step 4: Configure Firewall Rules
1. Open the Digital Ocean control panel and navigate to your Nexus Droplet.
2. Go to Networking and configure the firewall's inbound rules to allow access to the designated port.
Step 5: Configure Realms in Nexus
1. Check if your Nexus instance is running on HTTP or HTTPS.
2. If it's running on HTTP, follow the steps provided in the Docker documentation to test an insecure registry.
3. Configure the realms in Nexus to enable authentication and generate tokens for Docker clients.
NOTE: [Realms:?When we do docker login we get a token of Authentication from the Nexus docker repository for a client and that token will be stored on your local machine in a file : [ ~/.docker/config.json]
So this Json file will include all the authentication that you have made to all the different docker repositories]
Step 6: Docker Login
1. Use the `docker login [RepositoryIPAddress:Port]` command to authenticate and receive an authentication token from the Nexus Docker repository.
Step 7: Build the Docker Image
1. Build your Docker image using the necessary Dockerfile and specifications.
Step 8: Tag the Image
1. Tag the Docker image with the Docker repository address to rename it accordingly.
Step 9: Push the Image to the Docker Host Repository
1. Use the `docker push [RepositoryAddress/ImageName:Tag]` command to push the Docker image to the Nexus Docker Host Repository.
And this is our Docker Hosted Repository in Nexus:
Following these steps, you will have successfully pushed and pulled Docker images from your Nexus Docker Host Repository. Ensure that you configure the necessary settings and authentication correctly to enable seamless interaction between your Docker client and the Nexus repository.
Software architect and lead developer
9 个月Finally found a good article :)