A Helm Chart containing: dind-rootless - as docker build service
export pod_name=$(kubectl get pod \
--selector=app.kubernetes.io/name=secureremotedind \
--no-headers -o custom-columns=":metadata.name")
kubectl exec -it $pod_name -- docker info
-
Download needed certificates
mkdir -p `pwd`/certs/ca export secret_name=$(kubectl get secret \ --selector=app.kubernetes.io/name=secureremotedind \ --no-headers -o custom-columns=":metadata.name") #download tls.key kubectl get secret ${secret_name} \ -o jsonpath="{.data.tls\.key}" | base64 --decode \ > `pwd`/certs/ca/key.pem #download ca.crt kubectl get secret ${secret_name} \ -o jsonpath="{.data.ca\.crt}" | base64 --decode \ > `pwd`/certs/ca/ca.pem #ca.crt == tls.crt because it's the root CA cp -f `pwd`/certs/ca/ca.pem `pwd`/certs/ca/cert.pem
-
Forward the tcp port 2376 of the docker-in-docker service
export service_name=$(kubectl get service \ --selector=app.kubernetes.io/name=secureremotedind \ --no-headers -o custom-columns=":metadata.name") kubectl port-forward svc/${service_name} 2376:2376
-
connect to docker
export DOCKER_HOST=tcp://localhost:2376 export DOCKER_TLS_VERIFY=1 export DOCKER_CERT_PATH=`pwd`/certs/ca docker info
curl https://localhost:2376/info \ --cert `pwd`/certs/ca/cert.pem \ --key `pwd`/certs/ca/key.pem \ --cacert `pwd`/certs/ca/ca.pem \ | jq