Friday, February 21, 2020

How to upload Docker images into Nexus docker Registry - Upload Docker images to Nexus Decker Registry

How to upload Docker images into Nexus docker Registry - Upload Docker images to Nexus Decker Registry.

Pre-Requistes:

Docker is installed and up and running.
Nexus is up and running and Docker registry is already configured. If you have not configured yet, click here to setup Nexus 3 to configure as Docker Registry.

Steps to configure in Docker to upload Docker images to Nexus
login to EC2 instance where you have installed Docker, try to perform below commands:
Configure Docker service to use insecure registry with http. Create Docker daemon file if it does not exist.

sudo vi /etc/docker/daemon.json
Add entries like below:
Enter Nexus URL along with port number used for Docker registry.


{
    "insecure-registries" : ["nexus_public_dns_name:8085"]
}


Restart Docker daemon after above configuration changes.

sudo systemctl restart docker

sudo systemctl status docker
Make sure Docker was able to restart successfully. Press q to come out of above window.


Login to Docker Registry hosted in Nexus 3

Make sure you are able to login to Docker Registry hosted in Nexus by executing below command:
sudo docker login -u admin -p admin123 nexus_public_dns_name:8085




Download Dockerized code

git clone https://bitbucket.org/ananthkannan/mydockerrepo; cd mydockerrepo/pythonApp

Create a Docker image and tag the image per Nexus Registry

sudo docker build . -t nexus_public_dns_name:8085/mypythonapp




Push the image into Docker Registry
sudo docker push nexus_public_dns_name:8085/mypythonapp



Verify in Nexus if images are uploaded successfully
Login to Nexus, click on Browse, choose Docker registry

Please watch in YouTube channel for the demo:

No comments:

Post a Comment