Docker in Docker

A Software Product Engineer, Cloud enthusiast | Blogger | DevOps | SRE | Python Developer. I usually automate my day-to-day stuff and Blog my experience on challenging items.
Search for a command to run...

A Software Product Engineer, Cloud enthusiast | Blogger | DevOps | SRE | Python Developer. I usually automate my day-to-day stuff and Blog my experience on challenging items.
No comments yet. Be the first to comment.
The way we consume tech content has changed - my blog is changing with it. Introducing the Prompts series.

Deep metrics, log shipping, and a ready dashboard before your performance test starts - plus the war story of why it matters.
One prompt that lets an LLM read, draft, and publish on your Hashnode blog - token stays safe in an env var.
Hello All, If you've been running Argo CD on EKS, you know the drill — install the helm chart, manage the controllers, handle upgrades, configure SSO, worry about HA, and repeat for every cluster. It'

Introduction If you've spent any time managing data pipelines in the real world, you know the pain of deploying changes manually — copy-pasting notebooks, praying nothing breaks in prod, and maintaini

There was a time I once visualised this scenario, Also have discussed with one of mentor (Allwyn) of this usage. How come it would be if we could use docker inside a Docker container. :p

Sounds buzzy; Yes it is.
There are several scenarios where we may end up using a scenario like this. We will see one such scenario and a simple way to implement them.
The scenario I faced was like when automating the process of building the Docker image. To build a Docker image, we can simply do
for this we need docker needs to be installed in our machine so that it can be automated via Jenkins
Okay, let us assume we have hosted the Jenkins as docker container, then what??
Shall we connect the container and install docker in it? Are you sure?
Yes, we have some cool solutions for this.
https://hub.docker.com/_/docker
This means, if you pull an image inside the container, this image will also be visible on the host system (and vice versa). The above solution is straight forward, like the nested scene. A docker daemon will be installed inside the container.
However there are other optimal solutions for this scenario;
Just mount the docker sock (from local install path) with the docker image while starting up the container.
-v /var/run/docker.sock:/var/run/docker.sock
docker run --name myjenkins -p 8080:8080 -p 50000:50000 -v /var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock jenkins
sudo chown root:{USER} /var/run/docker.sock
docker exec -it jenkins /bin/bash
docker ps docker images
full command is as follows; I have started jenkins container by mounting the volumes
make sure the docker.sock file has permissions to the docker user group
Note: replace the user with the user from which you start the docker container: my case it is ubuntu
Now log into the docker image and check you have the access for the same.
Inside the container try running the docker commands
☮
Thank you,
[DISPLAY_ULTIMATE_SOCIAL_ICONS]
Originally published at https://opsinsights.dev on March 25, 2019.