# Docker within docker privileged mode for web app hosting

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdocker-within-docker-privileged-mode-for-web-app-hosting%2F55277%3E%5C
**Category:** Spaces\
**Created:** [September 16, 2023, 8:02pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdocker-within-docker-privileged-mode-for-web-app-hosting%2F55277 "2023-09-16T20:02:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreped](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/andreped/32/33289_2.png) [@andreped](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fandreped)%5C
**Post date:** [September 16, 2023, 8:02pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdocker-within-docker-privileged-mode-for-web-app-hosting%2F55277%2F1 "2023-09-16T20:02:15Z")

</div>

Apparently, HF spaces does have plans to support `docker-compose`, as discussed in [this thread](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsupport-for-docker-compose-in-spaces%2F41512).

This is an issue, as I want to test if I could deploy an already containerized web solution through Hugging Face, for pure demo purposes - to showcase the web solution and some AI models on medical images.

As HF spaces did not support `docker-compose`, I figured I might get around the issue by going for a docker-within-docker approach. However, to run `docker-compose` inside the `Dockerfile`, which is required and expected by the HF space for deployment, I’m running into some issues. I became aware of some limitations with said approach. To access and run docker commands from within docker, I will need to launch the original docker container by:

```auto
docker run -v /var/run/docker.sock:/var/run/docker.sock -ti docker

```

As I doubt that HF spaces has this by default, I guess this is not viable. Alternatively, if the original container is spawned in privileged mode, I wouldn’t need to do the `docker.sock` approach:

```auto
docker run --privileged -d --name dind-test docker:dind

```

But then again, I doubt HF spaces do any of these. Are there any other workaround I am not seeing?

My project is hosted at:

> **[Digital Slide Archive: Platform for working with large microscopy images. - a...](https://huggingface.co/spaces/andreped/dsa4hf)**
>
> Discover amazing ML apps made by the community

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [September 16, 2023, 8:19pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdocker-within-docker-privileged-mode-for-web-app-hosting%2F55277%2F2 "2023-09-16T20:19:47Z")

</div>

hi @andreped this is very cool! I’m going to loop @XciD and @chris-rannou here and see if they can tell us if that’s possible.

---

<div class="post-metadata">

**Author:** ![andreped](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/andreped/32/33289_2.png) [@andreped](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fandreped)%5C
**Post date:** [September 17, 2023, 7:33pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdocker-within-docker-privileged-mode-for-web-app-hosting%2F55277%2F3 "2023-09-17T19:33:40Z")

</div>

Note that to deploy locally, you can simply do:

```auto
git clone https://github.com/andreped/dsa4hf
cd dsa4hf/dsa/
docker-compose pull
DSA_USER=$(id -u):$(id -g) docker-compose up

```

In essense, this is what I want to get working on HF spaces. If I manage to find a solution to this, there are also other web apps I could do the same fix for, so a workaround to this problem would be great :]

---

<div class="post-metadata">

**Author:** ![Ark-kun](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ark-kun/32/54494_2.png) [@Ark-kun](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FArk-kun)%5C
**Post date:** [October 2, 2025, 10:36pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdocker-within-docker-privileged-mode-for-web-app-hosting%2F55277%2F4 "2025-10-02T22:36:42Z")

</div>

@XciD @chris-rannou So, is running multiple Docker containers inside a single HuggingFace Space possible in 2025?
