- Jenkins
- OWASP ZAP
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose docker-compose -v
wget https://github.com/goharbor/harbor/releases/download/v1.9.4/harbor-online-installer-v1.9.4.tgz tar xvfz harbor-online-installer-v1.9.4.tgz cd harbor vi harbor.yml // port 변경가능 ./install.sh
ID : admin / Pass : Harbor12345
vi harbor.xml # hostname # https 주석(미사용시) ./prepare #docker-compose reset docker-compose down -v docker-compose up -d
ke-c-dcn6h-default-0-41c99d2b-zkp7 ~ # vim /etc/default/docker gke-c-dcn6h-default-0-41c99d2b-zkp7 ~ # gke-c-dcn6h-default-0-41c99d2b-zkp7 ~ # systemctl restart docker gke-c-dcn6h-default-0-41c99d2b-zkp7 ~ # gke-c-dcn6h-default-0-41c99d2b-zkp7 ~ # gke-c-dcn6h-default-0-41c99d2b-zkp7 ~ # cat /etc/default/docker DOCKER_OPTS="-p /var/run/docker.pid --iptables=false --ip-masq=false --log-level=warn --bip= 169.254.123.1/24 --registry-mirror=https://mirror.gcr.io --log-driver=json-file --log-opt=ma x-size=10m --log-opt=max-file=5 --insecure-registry 34.64.237.112" gke-c-dcn6h-default-0-41c99d2b-zkp7 ~ # docker info | grep Insecure -A2 Insecure Registries: 34.64.237.112 127.0.0.0/8
gke-c-dcn6h-default-0-41c99d2b-zkp7 ~ # docker login http://34.64.237.112 Username: admin Password: Error response from daemon: Get http://34.64.237.112/v2/: Get http://jenkins/service/token?a ccount=admin&client_id=docker&offline_token=true&service=harbor-registry: dial tcp: lookup j enkins on 169.254.169.254:53: no such host
gke-c-dcn6h-default-0-41c99d2b-zkp7 ~ # cat /etc/hosts | grep jenkins 34.64.237.112 jenkins
gke-c-dcn6h-default-0-41c99d2b-b3hf ~ # docker login http://34.64.237.112 Username: admin Password: WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store Error saving credentials: mkdir /root/.docker: read-only file system
[root@rancher ~]# docker pull 34.64.237.112/nasa1515/centos:latest latest: Pulling from nasa1515/centos e4c3d3e4f7b0: Pull complete 101c41d0463b: Pull complete 8275efcd805f: Pull complete 751620502a7a: Pull complete a59da3a7d0e7: Pull complete 5ad32ac1e527: Pull complete 50f250ce9768: Pull complete 3dd70b2a7b06: Pull complete 8c2eed4e2f48: Pull complete 724b4bfec817: Pull complete 61ae8c03d512: Pull complete 9a94fab24995: Pull complete da240281d421: Pull complete a3770e71565d: Pull complete e1c790c868f5: Pull complete 70b50f1bf238: Pull complete Digest: sha256:cc72b06299df2ca6ed89a93190f062cb918185742afe270a5e179b2ab52c1d17 Status: Downloaded newer image for 34.64.237.112/nasa1515/centos:latest 34.64.237.112/nasa1515/centos:latest [root@rancher ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE 34.64.237.112/nasa1515/centos latest d35d713b85e5 12 days ago 892M B
kubectl get secret regcred --output=yaml apiVersion: v1 data: .dockerconfigjson: eyJhdXRocyI6eyJodHRwOi8vMzQuNjQuMjM3LjExMiI6eyJ1c2VybmFtZSI6ImFkbWluIiwicGFzc3dvcmQiOiJIYXJib3IxMjM0NSIsImF1dGgiOiJZV1J0YVc0NlNHRnlZbTl5TVRJek5EVT0ifX19 kind: Secret metadata: creationTimestamp: "2020-11-12T09:29:40Z" name: regcred namespace: default resourceVersion: "13089794" selfLink: /api/v1/namespaces/default/secrets/regcred uid: 50cc6a2d-0f39-4fed-96e7-d5edde4e0f37 type: kubernetes.io/dockerconfigjson > > > kubectl get secret regcred --output="jsonpath={.data.\.dockerconfigjson}" | base64 --decode base64: unrecognized option: decode BusyBox v1.31.1 () multi-call binary. Usage: base64 [-d] [FILE] Base64 encode or decode FILE to standard output -d Decode data > > > kubectl get secret regcred --output="jsonpath={.data.\.dockerconfigjson}" | base64 -d {"auths":{"http://34.64.237.112":{"username":"admin","password":"Harbor12345","auth":"YWRtaW46SGFyYm9yMTIzNDU="}}}>
pipeline { environment { slack_channel = '#studying' REGISTRY = 'nasa1515/wonseok' REGISTRY_IP = '34.64.237.112' <<-- Harbor IP REGISTRYCREDENTIAL = 'harbor' <<-- Credential DOCKER_IMAGE = '' TAG_NUM = '' } ... ...(중략) stage('Docker image push to Harbor') { <<-- 다음과 같이 푸시하도록. steps{ script { docker.withRegistry('http://$REGISTRY_IP', REGISTRYCREDENTIAL) { DOCKER_IMAGE.push('${BUILD_NUMBER}') DOCKER_IMAGE.push("latest") } } sh 'docker rmi $REGISTRY:latest' sh 'docker rmi $REGISTRY_IP/$REGISTRY:$BUILD_NUMBER' sh 'docker rmi $REGISTRY_IP/$REGISTRY:latest' }