I have a server with Docker and I want to run Jenkins inside a container, until here it’s all fine.
But I want to build and deploy images/containers to the same server where the Jenkins container is running.
I know the Jenkins container does have no way to do this because it’s inside a container, but I would start the Jenkins container with a volume:
-v /var/run/docker.sock:/var/run/docker.sock
Does this work or is it not possible? Because I do not want a Docker inside a Docker.
The other option would be to just install Jenkins on the server, not inside a container.
You can have Jenkins run inside a container and use Docker for the agents, but you’re approach is incorrect. Since Jenkins is inside a container you would treat Docker like it’s a remote system and Jenkins will connect out to the network and then back into the host. In Jenkins you will select:
It’s pretty much impossible. Jenkins supports running containers but if Jenkins is a container then you are going to have a terrible time if you need to pass files and folders from the Jenkins container to its child containers.