# How can I run pi-hole on docker container

**URL:** <https://discourse.pi-hole.net/t/how-can-i-run-pi-hole-on-docker-container/68541>\
**Category:** docker\
**Created:** [February 23, 2024, 2:36pm UTC](https://discourse.pi-hole.net/t/how-can-i-run-pi-hole-on-docker-container/68541 "2024-02-23T14:36:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![punit\_p\_1990](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/p/dc4da7/32.png) [@punit\_p\_1990](https://discourse.pi-hole.net/u/punit_p_1990)\
**Post date:** [February 23, 2024, 2:36pm UTC](https://discourse.pi-hole.net/t/how-can-i-run-pi-hole-on-docker-container/68541/1 "2024-02-23T14:36:18Z")

</div>

Hello Pi-Hole Team,

You are doing an amazing job with the pi-hole.

I have a question as to how can I run pi-hole on a docker container?

So far I was able to host the pi-hole on a macvlan so that I can assign host network to the pi-hole.

However, it wouldn't let me connect to it as I need to have password specified.

If I am hosting docker-compose.yml file on linux vm then I can.

But the way I am doing using macvlan it won't, since it's getting image pihole/pihole:latest directly.

So is there a way I can modify the password?

┌──(kali㉿kali)-[~/pihole]

└─$ sudo docker run -itd --rm --network newpihole \

--ip 10.5.5.106 \

--name pihole pihole/pihole:latest

c562ff90\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*c7e0b43772986a014f695245612419

Regards,

---

<div class="post-metadata">

**Author:** ![Bucking\_Horn](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/bucking_horn/32/18719_2.png) [@Bucking\_Horn](https://discourse.pi-hole.net/u/Bucking_Horn)\
**Post date:** [February 23, 2024, 2:50pm UTC](https://discourse.pi-hole.net/t/how-can-i-run-pi-hole-on-docker-container/68541/2 "2024-02-23T14:50:45Z")

</div>

Have a look at our [Quick Start sample configuration](https://github.com/pi-hole/docker-pi-hole#quick-start), and apply that together with the [Recommended Environment Variables](https://github.com/pi-hole/docker-pi-hole?tab=readme-ov-file#recommended-variables).

---

<div class="post-metadata">

**Author:** ![punit\_p\_1990](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/p/dc4da7/32.png) [@punit\_p\_1990](https://discourse.pi-hole.net/u/punit_p_1990)\
**Post date:** [February 23, 2024, 3:10pm UTC](https://discourse.pi-hole.net/t/how-can-i-run-pi-hole-on-docker-container/68541/3 "2024-02-23T15:10:52Z")

</div>

Thank You for the link.  
I was able to get it to work using  
sudo docker exec -it pihole -a -p

---

<div class="post-metadata">

**Author:** ![rdwebdesign](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/rdwebdesign/32/51363_2.png) [@rdwebdesign](https://discourse.pi-hole.net/u/rdwebdesign)\
**Post date:** [February 23, 2024, 4:32pm UTC](https://discourse.pi-hole.net/t/how-can-i-run-pi-hole-on-docker-container/68541/4 "2024-02-23T16:32:02Z")

</div>

**Note:**

You can also use the environment variable: `WEBPASSWORD`  
_(explained on the link posted by **Bucking\_Horn** above)_.
