gocd / docker-gocd-agent

GoCD Agent Docker image
https://hub.docker.com/r/gocd/
47 stars 37 forks source link

Add GoCD DinD agent. #55

Closed varshavaradarajan closed 6 years ago

MPV commented 6 years ago

@varshavaradarajan How do I use this?

The GoCD DinD agent starts and registers in the GoCD server successfully, but the Docker engine doesn't start inside it, so jobs needing Docker fail on this agent.

This is what I get in the /usr/local/bin/nohup.out file inside the container of the DinD agent:

mount: permission denied (are you root?)
Could not mount /sys/kernel/security.
AppArmor detection and --privileged mode might break.
mount: permission denied (are you root?)

I get the same output if I run the command myself manually inside the container: sh -c "$(which dind) dockerd --host=unix:///var/run/docker.sock --host=tcp://0.0.0.0:2375 --storage-driver=vfs"

MPV commented 6 years ago

Ah, I see now that I probably need to run the DinD agent in "privileged mode":

Docker in Docker (DinD) [...] This requires that the host docker container be run in privileged mode. [...]

https://docs.gocd.org/current/gocd_on_kubernetes/designing_a_cd_pipeline/docker_workflows.html#docker-in-docker-dind

...alternatively:

Tip: Check the 'Privileged mode' checkbox which is essential to run the Docker in Docker image.

https://docs.gocd.org/current/gocd_on_kubernetes/gocd_helm_chart/configure_k8s_ea_plugin.html#create-an-elastic-profile