Skip to main content

Copy Docker Image From one Repo to Another Repository

This Blog would help you on how you can copy one docker image to another repository, this is useful when people want to host their own docker registry and copy the images there.

FROM AWS ECR to private repo

Create file copy-docker-image.sh

repo="ACCOUNT_ID.dkr.ecr.ap-south-1.amazonaws.com"

aws ecr get-login-password --region ap-south-1 | sudo docker login --username AWS --password-stdin $repo

push_repo="172.31.1.250:5000"
sudo docker pull $repo/$1
sudo docker tag $repo/$1 $push_repo/$2:$3
sudo docker push $push_repo/$2:$3

Note: Make sure you have aws cli setup with aws configure with correct credentials to pull the image

DOCKER hub to private repo

Create file copy-docker-image.sh

repo="docker.io"

push_repo="172.31.1.250:5000"
sudo docker pull $repo/$1
sudo docker tag $repo/$1 $push_repo/$2:$3
sudo docker push $push_repo/$2:$3

Usage

chmod +x copy-docker-image.sh

./copy-docker-image.sh nginx:1.24  nginx v1.24

Comments

Popular posts from this blog

Monitor On Prem Resources From kube prom stack (Prometheus)

For this you would need Few Items Endpoints Service ServiceMonitor --- apiVersion: v1 kind: Endpoints metadata: name: onprem-proxy namespace: monitoring subsets: - addresses: - ip: "192.168.10.10" - ip: "192.168.10.11" ports: - name: 'onprem-proxy-metrics' protocol: TCP port: 9100 --- apiVersion: v1 kind: Service metadata: name: onprem-proxy namespace: monitoring labels: app.kubernetes.io/name: onprem-proxy spec: ports: - name: "onprem-proxy-metrics" protocol: TCP port: 9100 targetPort: 9100 --- apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: onprem-proxy namespace: monitoring spec: endpoints: - interval: 10s path: /metrics port: onprem-proxy-metrics namespaceSelector: matchNames: - monitoring selector: matchLabels: app.kubernetes.io/name: onprem-proxy

Microsoft Ldap login using python

Microsoft Ldap login using python3 Install dependent packages python3 -m pip install ldap3 Sample Code to test login from ldap3 import Server, Connection, ALL, SUBTREE from ldap3.core.exceptions import LDAPException, LDAPBindError def connect_ldap_server(SERVER_URI, DN,USERNAME, PASSWORD): try: # Provide the hostname and port number of the openLDAP server = Server(SERVER_URI, get_info=ALL) # username and password can be configured during openldap setup connection = Connection(server, user='CN='+USERNAME+','+DN, password=PASSWORD) bind_response = connection.bind() # Returns True or False return bind_response except LDAPBindError as e: connection = e return False # print(connection) # print(bind_response) if connect_ldap_server('ldap://9.1.0.3','OU=Headoffice,DC=example,DC=com', 'testuser',...

Add a Approval System in Jenkins For Build

Approval System in Jenkins For Build Use Cases: Only Specific users must be able to approve the build Speific users should be able to run the build without Approval Approval Can be turn off and On On-Demand Jenkins Variables Needs to Created under ( Manage Jenkins > Configure System > Environment variables ) ApprovalAdmins (Value: jenkins emails comma separated) skipApprovalUsers (Value: jenkins emails comma separated) BuildApproval (Value: True, False) import jenkins.model.Jenkins def getBuildUser() { return currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')['userId'] } pipeline { agent { label 'ec2-fleet-common' } stages { stage('Approval Process') { when { expression { env.BuildApproval == 'True' || env.BuildApproval == 'true' } } steps { script { ...