Create secret
kubectl create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>
transfor to yaml format
kubectl get secret regcred --output=yaml
Create secret file Yml with output information
apiVersion: v1
kind: Secret
metadata:
name: registryfront-credentials
namespace: ael-0001-payroll-uat
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: eyJhdXRocyI6eyJodHRwczovL2luZGV4LmRgY2tlci5pby92MS8iOnsidXNlcm5hbWUiOiJ2aXhhdml4YSIsInBhc3N3b3JkIjoiZGNrrl9wYXRfck94R3Q3cEVqd3U3N1pzUFNjQXBSMpluOGxVIiwiZW1haWwiOiJ2aXhhd2ViM0BnbWFpbC5jb20iLCJhdXRoIjoiZG1sNFlYWnBlR0U2WkdOcmNsOXdZWFJmY2s5NFIzUTNjRVZxZDNVM04xcHpVRk5qUVhCU01qbHVPR3hWIn19fQ==
Put this file into K8S manifests
Create access token into Dockerhub
go to the profile and create access token, then use it into gitlabci file
- docker login -u "vixavixa" -p "dckr_pat_rOxGt7pEjwu658sPScApR2sqsq8lU" docker.io
script:
- docker build -t vixavixa/images:nginx1 -f Dockerfile .
- docker push vixavixa/images:nginx1
after_script:
- docker logout
vixavixa/images is the repository into dockerhub and nginx1 is the tag