feat: allow more dockerd options (#2701)

This commit is contained in:
Thorsten Wildberger 2023-07-25 06:59:49 +02:00 committed by GitHub
parent 06cbd632b8
commit dc58f6ba13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 1 deletions

View File

@ -66,4 +66,47 @@ spec:
value: "172.17.0.0/12"
- name: DOCKER_DEFAULT_ADDRESS_POOL_SIZE
value: "24"
```
More options can be configured by mounting a configmap to the daemon.json location:
- rootless: /home/runner/.config/docker/daemon.json
- rootful: /etc/docker/daemon.json
```yaml
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
name: example-runnerdeployment
spec:
template:
spec:
dockerdWithinRunnerContainer: true
image: summerwind/actions-runner-dind(-rootless)
volumeMounts:
- mountPath: /home/runner/.config/docker/daemon.json
name: daemon-config-volume
subPath: daemon.json
volumes:
- name: daemon-config-volume
configMap:
name: daemon-cm
items:
- key: daemon.json
path: daemon.json
securityContext:
fsGroup: 1001 # runner user id
```
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: daemon-cm
data:
daemon.json: |
{
"log-level": "warn",
"dns": ["x.x.x.x"]
}
```

View File

@ -146,5 +146,9 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
&& which docker-compose \
&& docker compose version
# Create folder structure here to avoid permission issues
# when mounting the daemon.json file from a configmap.
RUN mkdir -p /home/runner/.config/docker
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["entrypoint-dind-rootless.sh"]

View File

@ -123,5 +123,9 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
&& which docker-compose \
&& docker compose version
# Create folder structure here to avoid permission issues
# when mounting the daemon.json file from a configmap.
RUN mkdir -p /home/runner/.config/docker
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["entrypoint-dind-rootless.sh"]

View File

@ -5,7 +5,6 @@ trap graceful_stop TERM
log.notice "Writing out Docker config file"
/bin/bash <<SCRIPT
mkdir -p /home/runner/.config/docker/
if [ ! -f /home/runner/.config/docker/daemon.json ]; then
echo "{}" > /home/runner/.config/docker/daemon.json