How to install WordPress with Docker on a VPS or a dedicated server
Find out how to quickly install WordPress with Docker on a VPS or an OVHcloud dedicated server
Objective
Installing WordPress on a VPS or dedicated server has several advantages, such as full customization of the environment, performance optimization, and enhanced security. There are several ways to install WordPress on a VPS or dedicated server, depending on your technical level and the time you want to devote to it. One of the quickest and most efficient ways to do this is to use Docker. Docker makes it easy to deploy applications by 'containerizing' them, making WordPress installation fast, easy, and repeatable in any environment.
Find out how to install WordPress manually with Docker on a VPS or an OVHcloud Dedicated Server.
Información sobre la administración de los servicios de OVHcloud y cómo encontrar la asistencia adecuada
Al utilizar las guías de OVHcloud, tenga en cuenta las siguientes condiciones:
- Las instrucciones pretenden ofrecer el mayor detalle posible, pero no pueden cubrir todos los casos de uso individuales. Es posible que deba adaptar las acciones descritas a sus necesidades.
- El ecosistema de OVHcloud está diseñado para ofrecer flexibilidad y libertad de elección. Por lo tanto, los clientes son responsables de la configuración correcta y segura de sus servicios. Para evitar la pérdida de datos, recomendamos encarecidamente aplicar estrategias de copia de seguridad a todos sus datos importantes.
- Nuestras guías y tutoriales pueden hacer referencia a software o servicios de terceros en combinación con las soluciones de OVHcloud. El soporte técnico de OVHcloud no incluye la configuración de sistemas o productos fuera de nuestra responsabilidad. Esto incluye, entre otros:
- Sistemas operativos e interfaces de usuario (Windows, Debian, Plesk, etc.).
- Cualquier otro software de terceros (clientes FTP, software de correo electrónico, etc.).
- Servicios ofrecidos por otros proveedores (DNS, API, interfaces de usuario, etc.).
Para recibir la asistencia adecuada ante cualquier problema, siga estas recomendaciones:
- ¿Busca asesoramiento personalizado o desea tratar un tema que no se aborda en detalle en nuestra documentación?
Únase a la comunidad de OVHcloud para buscar su tema y contactar con otros usuarios. - ¿Necesita informar de un incidente relacionado con su servicio de OVHcloud o tiene dificultades en el área de cliente de OVHcloud?
Cree una solicitud de soporte en nuestro centro de ayuda. - ¿Necesita asistencia profesional para su proyecto o ayuda con tareas fuera de nuestro ámbito de soporte?
Visite nuestro portal de partners para encontrar expertos familiarizados con las soluciones de OVHcloud. - ¿Busca información más detallada sobre nuestros niveles de soporte y Professional Services?
Visite nuestras páginas web sobre los niveles de soporte de OVHcloud y los OVHcloud Professional Services.
Puede participar en la mejora de nuestra documentación:
- ¿Desea enviar comentarios para mejorar una guía o informar de información insuficiente en una página concreta?
Utilice los botones «¿Le ha resultado útil esta página?» al final de la página para hacérnoslo saber. - ¿Desea proponer una actualización concreta de la documentación?
Utilice la función «Editar esta página», disponible al final de la página y en la barra lateral.
Requirements
- A VPS solution or a dedicated server in your
- Administrative (sudo) access to your server via SSH
- A domain name (registered with OVHcloud or another registrar)
Instructions
The VPS used for this guide has a Debian distribution in version 11 (Bullseye). For more information, see the official Docker website.
Install Docker
Update the package manager:
Install the required packages to allow apt to use a repository over HTTPS:
Add the official Docker GPG key:
Add the Docker repository to your system:
Update the apt package index and install Docker Engine and the Docker Compose plugin:
Verify that Docker is installed and configured:
Test Docker with a simple command:
If the Docker installation is successful, you will receive a message like this:

Install Docker Compose
The Docker Compose plugin was installed with Docker Engine in the previous step.
Check the Docker Compose installation:
If the Docker Compose installation is successful, you will receive a message like this:

Deploy WordPress with Docker Compose
Create a folder for your WordPress project and navigate to it:
Create a docker-compose.yml file with your preferred text editor:
Copy and paste the following configuration into the docker-compose.yml file:
This Compose file creates a WordPress service and a MySQL service.
Launch the services with Docker Compose:
The Docker image used in this example is the official version wordpress:latest. This specific image is designed to work with an Apache web server. The official WordPress images on Docker Hub are regularly updated to include the latest stable PHP versions compatible with the current version of WordPress.
To find out the exact PHP version included in the wordpress:latest image at a specific time, you can run a container based on this image and check the PHP version directly.
Launch a temporary container with the image wordpress:latest:
This command gives you an answer like this:
As a reminder, Docker images are updated regularly. The version of the components in wordpress:latest can therefore change over time, as new versions are published and integrated into the image.
If you wish, you can use another Docker image.
Use a specific Docker image
Go to the Docker Hub WordPress section and identify the image that fits your needs. For example, if you choose to use the image wordpress:5-php7.4-fpm, you will need to edit your docker-compose.yml file with a text editor. Once the file is open, find the section of the wordpress service and modify the line image: to use the specific tag of the wordpress:5-php7.4-fpm image you have chosen. For example:
Apply changes
Launch or update your containers with Docker Compose. If this is your first time launching the project, use:
If your containers are already running and you want to apply the changes, use:
Check that everything is working as expected. You can check the logs of your WordPress container to ensure that it starts correctly and that there are no errors:
Access WordPress
You can now access WordPress from a browser. There are two ways of doing this:
- Via the IP address of your VPS:
<VPS_IP_ADDRESS>:8000 - Via your website's domain name:
<DOMAIN_NAME>:8000
Link the domain name to the IP address of the VPS or dedicated server
To access your website from a browser, first link the domain name of your WordPress website to the IP address of your VPS. Go to your .
In the left-hand menu, click Domain names, then select the domain name you have chosen for your WordPress website.
Click the DNS zone tab. In the table, identify the row with the value A, open the actions menu ⋮ on that row and click Edit the entry.
In the edit form, enter the IP address of your VPS or dedicated server in the Target field, then confirm your changes.
Initialize your WordPress website
When you log in for the first time, your browser must redirect you to <VPS_IP_ADDRESS>:8000/wp-admin/install.php (or <DOMAIN_NAME>:8000/wp-admin/install.php if you use the domain name). This means that WordPress is ready for the initial configuration phase. This page is the starting point for configuring your WordPress website, where you need to define key elements such as:
- Language
- The title of your website
- The username for site administration
- An associated password
- An email address
- etc.
Complete the installation of your WordPress website
Once all the necessary information has been completed and the form has been submitted, WordPress will finalize the installation. You will then be redirected to the login screen (wp-login.php), where you can log in with the username and password you have just created.

Conclusion
You have just installed WordPress on your VPS or OVHcloud dedicated server with a Docker image. You can now access your WordPress website from a browser.
For some general tips on securing a GNU/Linux-based server, see our guides:
Go further
How to install a web development environment on a VPS or a dedicated server
How to install WordPress with WP-CLI on a VPS or a dedicated server
For specialised services (SEO, development, etc.), contact OVHcloud partners.
Join our community of users.