Can I install Docker over a server with pre-installed cPanel and CentOS 7? Since I am not aware of Docker, I am not completely sure whether it will mess with cPanel or not. I already have a server with CentOS 7 and cPanel configured. I want to know if I can install Docker over this configuration I mentioned without messing up?
3 Answers
Yes you can install docker over cPanel/WHM just like installing it on any other CentOS server/virtual machine.
Just follow these simple steps (as root):
1) yum install -y yum-utils device-mapper-persistent-data lvm2 (these should be already installed...)
2) yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3) yum install docker-ce
4) enable docker at boot (systemctl enable docker)
5) start docker service (systemctl start docker)
The guide above is for CentOS 7.x. Don't expect to find any references or options related to Docker in the WHM interface. You will be able to control docker via command line from a SSH shell.
I have some docker containers already running on my cPanel/WHM server and I have no issues with them. I basically use them for caching, proxying and other similar stuff.
And as long as you follow these instructions, you won't mess-up any of your cPanel/WHM services/settings or current cPanel accounts/settings/sites/emails etc.
Not sure why you haven't tried this already!

- 4,349
- 2
- 23
- 38
-
4Thank you for the downvote... I'm looking forward to know the reason if you are kind enough to provide! – Bogdan Stoica Oct 02 '17 at 14:07
-
Can you use Docker on a cPanel server to substitute for WHM/cPanel? That means installing and maintaining websites, IP addresses, domain names, email accounts, DNS Zone Records, etc.? Someone at SitePoint recommends Docker for this. – David Spector Feb 28 '21 at 15:28
I've been doing research and working on getting Docker working on cPanel. It's not just getting it to work on a CentOS 7 box but rather making it palatable for the cPanel crowd in the form of a plugin. So far I can confirm that it's absolutely doable. Here's what I've accomplished and how:
- Integrate Docker Compose with cPanel (which is somewhat a step further from WHM)
- Leverage the user-namespace kernel feature in Linux so Docker services can't escalate their privileges (see userns remap)
- Leverage Docker Compose so users can build complex services and start ready apps from the store with a click
- Make sure services starting via Docker run on a non-public IP on the server. Everything gets routed via ProxyPass
cPanel has been gracious to provide a Slack channel for people to discuss this upcoming plugin. I'd be more than happy to invite you if you'd like to be kept updated or to contribute. Let me know!
FYI, there's more info here on https://www.unixy.net/docker if you're interested. Please note that this plugin is in private beta but more than happy to let people use it!

- 71
- 2
Yes you could, in fact someone else has done it already: https://github.com/mirhosting/cPanel-docker

- 2,928
- 3
- 27
- 37
-
No , Thats Will Require Reinstalling Everything. I Own A Dedicated Server Which Already Has Centos 7 with cPanel , But Now I Want Docker Too, Can I Install Over it ? – Afzaal Oct 01 '17 at 06:43
-
-
-
This should be helpful: https://docs.docker.com/engine/admin/volumes/volumes/#start-a-container-with-a-volume , then use any of these https://hub.docker.com/search/?isAutomated=0&isOfficial=0&page=1&pullCount=0&q=cpanel&starCount=0 to make it the way you desire – Sergiu Oct 01 '17 at 06:51
-
But this guide still wants docker to be pre installed over a server. Thats what i am skeptical of. If i install docker directly, and set it on different port, will it mess with cPanel or Centos that i already have ? – Afzaal Oct 01 '17 at 06:58
-
But why you don't do it on another server? I believe it is safer and like this you can try as much as you want, once that is done, or you create a new server and just copy the data over (create a persistent volume with your data) or just mount your current installation to your container. This will make sure that you are safe and don't affect what you've got already in place ;) – Sergiu Oct 01 '17 at 07:02