Using Docker containers from a private registry without a full trust chain (or: use your own DinD container) #717
Replies: 3 comments 13 replies
-
I am in a similar situation (behind enterprise firewall)! Quick question - I assume you needed to define the imagePullSecrets to snag your custom dind sidecar. Does setting the imagePullSecrets attribute of the RunnerDeployment manifest work for pulling in the dind sidecar? Im getting ready to test this out myself, so if I remember, I will post an update with my findings soon. |
Beta Was this translation helpful? Give feedback.
-
I didn't want to build a docker image with certs embedded in it (🤮 ). So instead I just mount the cert as a secret into the docker image. This should eliminate the need for a custom image. By putting the cert in the directory for the registry, I believe you don't need to install it as a root cert.
|
Beta Was this translation helpful? Give feedback.
-
The last issue I ran into was related to either my enterprise network config or AKS limitations, but I had to modify the /etc/hosts file to enforce localhost as IPv4 to prevent loopbacks. Found a solution posted by @skyscooby on the moby project #moby/moby/issues/35954 # Insert into entrypoint script
# Inline edits and moves don't work inside containers
sed 's/^::1.*localhost/::1\tip6-localhost/g' /etc/hosts > /etc/hosts.tmp
cat /etc/hosts.tmp > /etc/hosts
rm -f /etc/hosts.tmp Kind of hacky - but ¯\(ツ)/¯ |
Beta Was this translation helpful? Give feedback.
-
You can use your own runner container rather straightforward, since it is supported in the deployments you can:
The DinD runner comes from the controller where you can overwrite it as well. I'll show the yaml below.
I needed to use my own DinD container because our Kubernetes cluster (Rancher in this case) sits behind an internal proxy that sends all requests for images to an internal Artifactory Container Registry. The issue we had came from the Artifactory setup: internal policy dictactes self signed certificates (I know 😱). The bad part is that the internal images don't have a full trust chain setup: that means that a
docker pull image
for example fails, since the trust chain cannot be verified and docker will reject it. You can try several solutions (more info in my blogpost but in the end this one worked:actions-runner-controller
.1. Create your own DinD container
I created our own DinD container from the default DinD container. Since it is based on Alpine, we need to add our certs to the folder
/etc/ssl/certs/
. I added all the internal certs that we use, but you can do that with a single cert as well.We where running our GitHub Actions on VM's that where based on Red Hat, so I loaded the certs from the trusted folder there
/etc/pki/ca-trust/source/anchors/
and added them to the container:2. Use your own DinD container in the controller deployment:
To use this container you need to update the controller deployment and include the full spec as below. The changes are in the
label
spec.template.spec.containers.args
where we start the controller manager with the argument--docker-image=registry.artifactory.mydomain.com/actions-runner-dind:latest
:Note: I had to do the same for the label
spec.template.spec.containers.manager,image
to enable the proxy to find our internal image forkube-rbac-proxy
because of something in the Artifactory setup. All other images where correctly mirrored on Artifactory and could be found without additional changes.Beta Was this translation helpful? Give feedback.
All reactions