Push and Pull Nexus Repository
https://www.ivankrizsan.se/author/ivan/

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.

No alt text provided for this image

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.

No alt text provided for this image

Roles: Goto Roles-> Create Role-> Enter the details (Role ID, Role Name,) and at the end assigned Privileges to the Role.

No alt text provided for this image

Now we go to the Users tab and assigned the Role to the user (nx-docker is the role we created here)

No alt text provided for this image

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.

No alt text provided for this image

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.

No alt text provided for this image
No alt text provided for this image

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]

No alt text provided for this image
No alt text provided for this image

Step 6: Docker Login

1. Use the `docker login [RepositoryIPAddress:Port]` command to authenticate and receive an authentication token from the Nexus Docker repository.

No alt text provided for this image

Step 7: Build the Docker Image

1. Build your Docker image using the necessary Dockerfile and specifications.

No alt text provided for this image

Step 8: Tag the Image

1. Tag the Docker image with the Docker repository address to rename it accordingly.

No alt text provided for this image

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.

No alt text provided for this image

And this is our Docker Hosted Repository in Nexus:

No alt text provided for this image

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.

Péter Molnár

Software architect and lead developer

9 个月

Finally found a good article :)

回复

要查看或添加评论,请登录

?? Deep Gosaliya的更多文章