Friday, February 21, 2020

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

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

Pre-requisites:

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 nexus_public_dns_name:8085

Now enter the Nexus admin password(it will not show the password when you type which is ok)


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 if Docker image is uploaded into Nexus successfully
Login to Nexus, click on Browse, choose Docker registry

Please watch in YouTube channel for the demo:


1 comment:

  1. Hello Coach, i had issues with this command sudo docker login -u admin -p admin123 nexus_public_dns_name:8085. I keep getting this response "WARNING! Using --password via the CLI is insecure. Use --password-stdin.
    Error response from daemon: Get http://ec2-35-89-60-223.us-west-2.compute.amazonaws.com:8085/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers). please advise!!!

    ReplyDelete