# Can I run Jenkins in a container and then create containers on the same docker server?

**URL:** <https://community.jenkins.io/t/can-i-run-jenkins-in-a-container-and-then-create-containers-on-the-same-docker-server/5475>\
**Category:** Ask a question\
**Tags:** question, docker\
**Created:** [January 25, 2023, 3:01pm UTC](https://community.jenkins.io/t/can-i-run-jenkins-in-a-container-and-then-create-containers-on-the-same-docker-server/5475 "2023-01-25T15:01:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julian](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@Julian](https://community.jenkins.io/u/Julian)\
**Post date:** [January 25, 2023, 3:01pm UTC](https://community.jenkins.io/t/can-i-run-jenkins-in-a-container-and-then-create-containers-on-the-same-docker-server/5475/1 "2023-01-25T15:01:07Z")

</div>

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:

```auto
-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.

---

<div class="post-metadata">

**Author:** ![Elliott](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/elliott/32/2892_2.png) [@Elliott](https://community.jenkins.io/u/Elliott)\
**Post date:** [January 27, 2023, 3:12pm UTC](https://community.jenkins.io/t/can-i-run-jenkins-in-a-container-and-then-create-containers-on-the-same-docker-server/5475/2 "2023-01-27T15:12:39Z")

</div>

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:

- Manage Jenkins
- Manage Nodes and Clouds
- Add a new cloud
- Select Docker
- Then add your details to your Docker host

---

<div class="post-metadata">

**Author:** ![shadycuz](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/shadycuz/32/196_2.png) [@shadycuz](https://community.jenkins.io/u/shadycuz)\
**Post date:** [April 9, 2023, 10:55pm UTC](https://community.jenkins.io/t/can-i-run-jenkins-in-a-container-and-then-create-containers-on-the-same-docker-server/5475/3 "2023-04-09T22:55:57Z")

</div>

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.
