axltxl/docker-jenkins-dood

Why install Docker in Dockerfile?

hasancansaral opened this issue ยท 3 comments

I am sorry to ask because I could not get why would you install Docker to the image running Jenkins. In that case, doesn't it become dind? e.g. This link here does not install docker but uses host's Docker socket. What am I missing? Thanks!

Hi @hasancansaral !

No need to be sorry ๐Ÿ˜„ , I perfectly understand the complications and concerns around the dockerception phenomenon ๐Ÿ˜Š

Long story short, docker is no longer a monolithic binary so to say, it now has several dependencies and these are changing in every release and they vary depending on the platform is running on. In previous releases of this image, you could easily bind your docker executable inside the container since docker was a purely monolithic binary back in the day, hence the sudo workaround which made possible to execute docker inside the container without any hassle. This docker image is based on the article you have just referred to, which was written back in the time you could easily do the aforementioned, but this is unfortunately no longer the case, so for later versions of docker, in order to guarantee a consistent set-up inside the container is simply to install it, making it agnostic to whatever is outside and only requiring a mapped unix socket to get it working out-of-the-box.

Though now this image is acquiring a built-in docker installation, it is still conceptually still considered a dood implementation, since mapping the socket onto the container makes the docker client communicate with an external docker daemon though it is not really aware of it, you can think of this container as one with a built-in docker client whose only need is to get the host's unix socket mapped onto it.

I hope this helps!.
Cheers ๐Ÿท

A-ha yes,docker and docker-cli! Cheers!

@axltxl Quick and a very unrelated question, and I would appreciate a lot if you could help me. I am newly experimenting with some features of Jenkins, and SSH is one of them.

1- In Manage Jenkins section, it asks for a port for sshd, then should I EXPOSE 22 for SSH? Or should I EXPOSE some other port and map it to same port on host?
2- I am guessing that this would be necessary for Publish over SSH, but which one.

Thanks in advance ๐Ÿ˜‹