{"id":4323,"date":"2019-11-07T05:39:23","date_gmt":"2019-11-07T05:39:23","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=4323"},"modified":"2025-07-29T08:36:21","modified_gmt":"2025-07-29T08:36:21","slug":"run-docker-wordpress","status":"publish","type":"post","link":"\/tutorials\/run-docker-wordpress\/","title":{"rendered":"How to install WordPress on Ubuntu using Docker"},"content":{"rendered":"<p>Installing WordPress on an Ubuntu virtual private server (VPS) commonly requires LAMP (Linux, Apache, MySQL, PHP). However, you can also set up the platform using Docker, a containerization tool that packages applications and their dependencies together.<\/p><p>Using Docker, WordPress installation becomes simpler, as it runs from pre-built images containing all necessary components. This approach offers several benefits: it&rsquo;s modular, easy to update and scale, and quick to redeploy should you need a new instance.<\/p><p>In this article, we&rsquo;ll explain how to install WordPress on Ubuntu using Docker. You&rsquo;ll learn each step, from preparing prerequisites to managing WordPress as a containerized content management system (CMS).<\/p><p class=\"has-text-align-center\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Docker-Cheat-Sheet.pdf\" target=\"_blank\" rel=\"noopener\">Download free docker cheat sheet<\/a><\/p><p>\n\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-prerequisites-for-installing-wordpress-with-docker\">Prerequisites for installing WordPress with Docker<\/h2><p>Before installing WordPress on Docker, make sure you have a VPS running a recent version of Ubuntu, such as <strong>22.04<\/strong> or later, to avoid compatibility issues.<\/p><p>Your server should also offer full root access to prevent permission errors when modifying system files. Additionally, <a href=\"\/tutorials\/dns\/how-to-point-domain-to-vps\/\">point a domain name to your VPS<\/a> so your WordPress website will be accessible to the public.<\/p><p>If you don&rsquo;t have a VPS, we suggest getting a <a href=\"\/vps\/docker-hosting\">Hostinger Docker VPS plan<\/a>. Since Docker and WordPress are relatively lightweight, our <strong>KVM 1<\/strong> plan &ndash; with a single-core CPU, <strong>4 GB<\/strong> of RAM, and <strong>50 GB<\/strong> of storage &ndash; should be sufficient. You can upgrade to a higher-tier plan if you need more resources as your site grows.<\/p><p>With Hostinger, you can connect to your VPS as root directly from your web browser, making the installation process more efficient.<\/p><p>If you encounter difficulties during setup, our <strong>Kodee AI assistant<\/strong> is available to guide you through managing your WordPress instance. Simply type your questions or describe your needs, and Kodee will write a step-by-step guide for you.<\/p><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-vps-hosting\" href=\"\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-how-to-install-wordpress-with-docker-compose\">How to install WordPress with Docker Compose<\/h2><p>Follow these steps to install WordPress using Docker. Before proceeding, access your VPS command-line interface (CLI) <a href=\"\/tutorials\/how-to-use-putty-ssh\/\">using the PuTTY SSH client<\/a> or terminal. Alternatively, use <strong>Hostinger Browser terminal<\/strong> if you need a simpler solution.<\/p><h3 class=\"wp-block-heading\" id=\"h-1-install-docker-and-docker-compose\">1. Install Docker and Docker Compose<\/h3><p>Hostinger users can install Docker and Docker Compose in a few clicks without commands using the preconfigured VPS template. This method is simpler and suitable for beginners.<\/p><p>\n\n\n    <div class=\"announcement-block announcement-block--warning\">\n        <span class=\"announcement-block__heading\">\n            <svg width=\"24\" height=\"26\" viewBox=\"0 0 24 26\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                d=\"M12 23.5C17.799 23.5 22.5 18.799 22.5 13C22.5 7.20101 17.799 2.5 12 2.5C6.20101 2.5 1.5 7.20101 1.5 13C1.5 18.799 6.20101 23.5 12 23.5ZM13.637 8.65198C13.637 7.74791 12.9041 7.01501 12 7.01501C11.0959 7.01501 10.363 7.74791 10.363 8.65198C10.5335 10.5375 10.875 14.383 10.875 14.383C10.875 15.0043 11.3787 15.508 12 15.508C12.6213 15.508 13.125 15.0043 13.125 14.383V14.38L13.637 8.65198ZM11.9927 16.714C11.3714 16.714 10.8677 17.2177 10.8677 17.839C10.8677 18.4603 11.3714 18.964 11.9927 18.964H12.0073C12.6286 18.964 13.1323 18.4603 13.1323 17.839C13.1323 17.2177 12.6286 16.714 12.0073 16.714H11.9927Z\"\n                fill=\"#BE1025\"\/>\n            <\/svg>\n            Warning        <\/span>\n        <p class=\"announcement-block__content\">\n            <strong>Warning!<\/strong> Installing a new VPS template will wipe your data. Back up important files before proceeding.        <\/p>\n    <\/div>\n\n    \n\n\n\n<\/p><p>To do so, simply open your VPS management page on <strong>hPanel<\/strong> and navigate to <strong>OS &amp; Panel<\/strong> &rarr; <strong>Operating System<\/strong>. Select <strong>Docker <\/strong>and click <strong>Change OS<\/strong>.<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"6a5884e25c706\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a5884e25c706\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/11\/hpanel-vps-operating-system-docker-highlighted-1024x253.png\" alt=\"The Docker template in VPS' Operating System page of hPanel\"><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n<\/div><p>If you want more flexibility when configuring the tool, <a href=\"\/tutorials\/how-to-install-docker-on-ubuntu\/\">install Docker<\/a> and Docker Compose using commands.<\/p><p>Now, verify if Docker and Docker Compose are configured correctly using the following commands:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker --version\ndocker-compose --version<\/pre><p>If these tools work properly, your CLI will output their version number:<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"6a5884e25cff1\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a5884e25cff1\" class=\"aligncenter size-full wp-lightbox-container\"><img decoding=\"async\" width=\"815\" height=\"132\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/terminal-outputs-docker-and-docker-compose-version.png\/public\" alt=\"Terminal outputs Docker and Docker Compose version\" class=\"wp-image-118458\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/terminal-outputs-docker-and-docker-compose-version.png\/w=815,fit=scale-down 815w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/terminal-outputs-docker-and-docker-compose-version.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/terminal-outputs-docker-and-docker-compose-version.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/terminal-outputs-docker-and-docker-compose-version.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 815px) 100vw, 815px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n<\/div><h3 class=\"wp-block-heading\" id=\"h-2-set-up-your-project-directory\">2. Set up your project directory<\/h3><p>Create a new project directory to house all your Docker and WordPress files using this command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mkdir wordpress<\/pre><p>By default, the command will create the <strong>wordpress <\/strong>folder in your current user&rsquo;s home directory. You can create it in another location or use a different name.<\/p><p>Then, open the folder using the command below:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd wordpress<\/pre><p>Once inside, you can start setting up Docker and WordPress.<\/p><h3 class=\"wp-block-heading\" id=\"h-3-create-a-docker-compose-file\">3. Create a Docker Compose file<\/h3><p>The <strong>Docker Compose file<\/strong> provides information about software components to install in your container. In this case, it specifies the configuration for WordPress and the database application.<\/p><p>To create a Docker Compose file, run the following command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano docker-compose.yml<\/pre><p>Paste the following configuration. Replace the username, password, and database name with your desired value.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">version: \"3\" \nservices:\n  db:\n    image: mysql:latest\n    restart: always\n    environment:\n      MYSQL_ROOT_PASSWORD: MySQLRootPassword\n      MYSQL_DATABASE: MySQLDatabaseName\n      MYSQL_USER: MySQLUsername\n      MYSQL_PASSWORD: MySQLUserPassword\n\n  wordpress:\n    depends_on:\n      - db\n    image: wordpress:latest\n    restart: always\n    ports:\n      - \"80:80\"\n    environment:\n      WORDPRESS_DB_HOST: db:3306\n      WORDPRESS_DB_USER: MySQLUsername\n      WORDPRESS_DB_PASSWORD: MySQLUserPassword\n      WORDPRESS_DB_NAME: MySQLDatabaseName\n    volumes:\n      - \".\/:\/var\/www\/html\"\n\n  phpmyadmin:\n    image: phpmyadmin\/phpmyadmin\n    restart: always\n    ports:\n      - \"8080:80\"\n    environment:\n      PMA_HOST: db\n      PMA_USER: MySQLUsername\n      PMA_PASSWORD: MySQLUserPassword\n\nvolumes:\n  mysql: {}<\/pre><p>Save the changes and return to the main shell by pressing<strong> Ctrl + X<\/strong> &rarr; <strong>Y<\/strong> &rarr; <strong>Enter<\/strong>. <\/p><h3 class=\"wp-block-heading\" id=\"h-4-start-the-docker-container\">4. Start the Docker container<\/h3><p>Run Docker Compose using this command to install and launch WordPress in a container. Remember that it only works when you are inside the project directory:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker-compose up -d<\/pre><p>Docker Compose will pull images from<strong> <\/strong><a href=\"https:\/\/docs.docker.com\/docker-hub\" target=\"_blank\" rel=\"noopener\">Docker Hub<\/a> as specified in your <strong>YAML <\/strong>file, configure the container, and set up the network connection. Depending on your internet speed, this setup process might take a few minutes.<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"6a5884e25dbcf\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a5884e25dbcf\" class=\"aligncenter size-full wp-lightbox-container\"><img decoding=\"async\" width=\"888\" height=\"148\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/terminal-shows-docker-has-completed-wordpress-installation.png\/public\" alt=\"Terminal shows Docker has competed WordPress installation\" class=\"wp-image-118459\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/terminal-shows-docker-has-completed-wordpress-installation.png\/w=888,fit=scale-down 888w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/terminal-shows-docker-has-completed-wordpress-installation.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/terminal-shows-docker-has-completed-wordpress-installation.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/terminal-shows-docker-has-completed-wordpress-installation.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 888px) 100vw, 888px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n<\/div><p>Once finished, you should see the <strong>Done <\/strong>status and return to the main shell.<\/p><h3 class=\"wp-block-heading\" id=\"h-5-access-the-wordpress-installation\">5. Access the WordPress installation<\/h3><p>With your Docker container up and running, you can now access the new WordPress installation through your web browser. Since your domain name is already pointed to the VPS, simply enter it in the browser&rsquo;s address bar.<\/p><p>This will take you to the WordPress setup wizard. Choose your preferred language and click <strong>Continue<\/strong>.<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"6a5884e25e4ea\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a5884e25e4ea\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"934\" height=\"1592\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-setup-wizard.png\/w=1024,h=1024,fit=scale-down\" alt=\"The WordPress setup wizard\" class=\"wp-image-118460\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-setup-wizard.png\/w=934,fit=scale-down 934w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-setup-wizard.png\/w=176,fit=scale-down 176w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-setup-wizard.png\/w=601,fit=scale-down 601w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-setup-wizard.png\/w=88,fit=scale-down 88w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-setup-wizard.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-setup-wizard.png\/w=901,fit=scale-down 901w\" sizes=\"(max-width: 934px) 100vw, 934px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n<\/div><p>Next, fill in the necessary information about your site, including the site title, username, password, and email address. Once complete, hit <strong>Install WordPress<\/strong>.<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"6a5884e25ebd8\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a5884e25ebd8\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1598\" height=\"1616\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-welcome-install-wordpress-highlighted.png\/w=1024,h=1024,fit=scale-down\" alt=\"The Install WordPress button in the WordPress Welcome page\" class=\"wp-image-118461\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-welcome-install-wordpress-highlighted.png\/w=1598,fit=scale-down 1598w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-welcome-install-wordpress-highlighted.png\/w=297,fit=scale-down 297w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-welcome-install-wordpress-highlighted.png\/w=1013,fit=scale-down 1013w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-welcome-install-wordpress-highlighted.png\/w=148,fit=scale-down 148w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-welcome-install-wordpress-highlighted.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-welcome-install-wordpress-highlighted.png\/w=1519,fit=scale-down 1519w\" sizes=\"(max-width: 1598px) 100vw, 1598px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n<\/div><p>After that, click <strong>Log In<\/strong> to enter the WordPress dashboard. Use the credentials you just created to access your admin panel.<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"6a5884e25f372\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a5884e25f372\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"2880\" height=\"1466\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-admin-dashboard.png\/w=1024,h=1024,fit=scale-down\" alt=\"The WordPress admin dashboard\" class=\"wp-image-118462\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-admin-dashboard.png\/w=2880,fit=scale-down 2880w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-admin-dashboard.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-admin-dashboard.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-admin-dashboard.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-admin-dashboard.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-admin-dashboard.png\/w=1536,fit=scale-down 1536w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/wordpress-admin-dashboard.png\/w=2048,fit=scale-down 2048w\" sizes=\"(max-width: 2880px) 100vw, 2880px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n<\/div><h3 class=\"wp-block-heading\" id=\"h-6-customize-your-docker-configuration\">6. Customize your Docker configuration<\/h3><p>For production environments, you&rsquo;ll need additional configurations so that your WordPress site is secure and optimized for performance. Below are key customizations to deploy WordPress using Docker:<\/p><p><strong>Using environment files<\/strong><\/p><p>To protect sensitive data, avoid hardcoding credentials like database usernames and passwords in your Docker Compose file. Instead, store these values in an environment file (<strong>.env<\/strong>).<\/p><p>In your <strong>wordpress<\/strong> directory, create a <strong>.env<\/strong> file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">nano .env<\/pre><p>Define your WordPress database credentials in the <strong>.env<\/strong> file, replacing placeholders with your own values:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">MYSQL_ROOT_PASSWORD=MySQLRootPassword\nMYSQL_DATABASE=MySQLDatabaseName\nMYSQL_USER=MySQLUsername\nMYSQL_PASSWORD=MySQLUserPassword<\/pre><p>Save the file, then update the <strong>docker-compose.yml<\/strong> file to use these environment variables:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">db:\n  image: mysql:latest\n  restart: always\n  environment:\n    MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}\n    MYSQL_DATABASE: ${MYSQL_DATABASE}\n    MYSQL_USER: ${MYSQL_USER}\n    MYSQL_PASSWORD: ${MYSQL_PASSWORD}<\/pre><p>Save the changes and restart Docker Compose to apply the new configurations:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker-compose up -d<\/pre><p><strong>Obtaining SSL certificates<\/strong><\/p><p>An SSL certificate is important for protecting user data and improving search engine rankings. To enable automatic SSL certificates, <a href=\"\/tutorials\/how-to-set-up-nginx-reverse-proxy\/\">add an NGINX proxy<\/a> with Let&rsquo;s Encrypt in your <strong>docker-compose.yml<\/strong> file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">services:\n  nginx-proxy:\n    image: jwilder\/nginx-proxy\n    container_name: nginx-proxy\n    ports:\n      - \"80:80\"\n      - \"443:443\"\n    volumes:\n      - \/var\/run\/docker.sock:\/tmp\/docker.sock:ro\n  letsencrypt-nginx-proxy-companion:\n    image: jrcs\/letsencrypt-nginx-proxy-companion\n    container_name: letsencrypt\n    environment:\n      NGINX_PROXY_CONTAINER: nginx-proxy\n    volumes:\n      - \/var\/run\/docker.sock:\/var\/run\/docker.sock:ro\n      - .\/certs:\/etc\/nginx\/certs\n      - .\/vhost.d:\/etc\/nginx\/vhost.d\n      - .\/html:\/usr\/share\/nginx\/html<\/pre><p>Next, remove port mapping from the <strong>wordpress<\/strong> service to avoid conflicts with <strong>nginx-proxy<\/strong>. Also, include SSL labels by replacing <strong>your_email<\/strong> and <strong>your_domain.com<\/strong> with your actual credentials:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">wordpress:\n  image: wordpress:latest\n  labels:\n    - \"VIRTUAL_HOST=your_domain.com\"\n    - \"LETSENCRYPT_HOST=your_domain.com\"\n    - \"LETSENCRYPT_EMAIL=your_email@your_domain.com\"<\/pre><p>In the same <strong>wordpress <\/strong>service, mount only the <strong>wp-content<\/strong> directory so that only necessary files are shared between the host and the container:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">volumes:\n  - .\/wp-content:\/var\/www\/html\/wp-content<\/pre><p>Here&rsquo;s the final <strong>docker-compose.yml<\/strong> content after using environment variables and adding SSL support with NGINX:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">version: \"3\"\n\nservices:\n  db:\n    image: mysql:latest\n    restart: always\n    environment:\n      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}\n      MYSQL_DATABASE: ${MYSQL_DATABASE}\n      MYSQL_USER: ${MYSQL_USER}\n      MYSQL_PASSWORD: ${MYSQL_PASSWORD}\n    volumes:\n      - mysql:\/var\/lib\/mysql\n\n  wordpress:\n    depends_on:\n      - db\n    image: wordpress:latest\n    restart: always\n    environment:\n      WORDPRESS_DB_HOST: db:3306\n      WORDPRESS_DB_USER: ${MYSQL_USER}\n      WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}\n      WORDPRESS_DB_NAME: ${MYSQL_DATABASE}\n    volumes:\n      - .\/wp-content:\/var\/www\/html\/wp-content\n    labels:\n      - \"VIRTUAL_HOST=your_domain.com\"\n      - \"LETSENCRYPT_HOST=your_domain.com\"\n      - \"LETSENCRYPT_EMAIL=your_email@your_domain.com\"\n\n  phpmyadmin:\n    image: phpmyadmin\/phpmyadmin\n    restart: always\n    ports:\n      - \"8080:80\"\n    environment:\n      PMA_HOST: db\n      PMA_USER: ${MYSQL_USER}\n      PMA_PASSWORD: ${MYSQL_PASSWORD}\n\n  nginx-proxy:\n    image: jwilder\/nginx-proxy\n    container_name: nginx-proxy\n    ports:\n      - \"80:80\"\n      - \"443:443\"\n    volumes:\n      - \/var\/run\/docker.sock:\/tmp\/docker.sock:ro\n      - .\/certs:\/etc\/nginx\/certs\n      - .\/vhost.d:\/etc\/nginx\/vhost.d\n      - .\/html:\/usr\/share\/nginx\/html\n\n  letsencrypt-nginx-proxy-companion:\n    image: jrcs\/letsencrypt-nginx-proxy-companion\n    container_name: letsencrypt\n    environment:\n      NGINX_PROXY_CONTAINER: nginx-proxy\n    volumes:\n      - \/var\/run\/docker.sock:\/var\/run\/docker.sock:ro\n      - .\/certs:\/etc\/nginx\/certs\n      - .\/vhost.d:\/etc\/nginx\/vhost.d\n      - .\/html:\/usr\/share\/nginx\/html\n\nvolumes:\n  mysql: {}<\/pre><p>Don&rsquo;t forget to save these changes and restart Docker Compose afterward:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker-compose up -d<\/pre><h3 class=\"wp-block-heading\" id=\"h-7-manage-and-scale-wordpress-with-docker\">7. Manage and scale WordPress with Docker<\/h3><p>After running WordPress in Docker for a while, scale your setup to optimize its performance and regularly back up your files to maintain data integrity. Here&rsquo;s how:<\/p><p><strong>Scaling WordPress containers<\/strong><\/p><p>As your site traffic grows, consider scaling your WordPress service to run multiple containers. It lets you evenly distribute user requests across different containers for optimal performance and uptime.<\/p><p>In your Docker Compose file, specify the desired number of replicas, such as <strong>3<\/strong>, to add more instances of your WordPress container:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> wordpress:\n    depends_on:\n      - db\n    image: wordpress:latest\n    restart: always\n    ports:\n      - \"80:80\"\n  environment:\n    WORDPRESS_DB_HOST: db:3306\n    WORDPRESS_DB_USER: ${MYSQL_USER}\n    WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}\n    WORDPRESS_DB_NAME: ${MYSQL_DATABASE}\n  volumes:\n    - \".\/:\/var\/www\/html\"\n  deploy:\n    replicas: 3<\/pre><p>Apply your changes by running:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker-compose up -d --scale wordpress=3<\/pre><p>Docker will now start additional WordPress containers and distribute traffic evenly between them.<\/p><p><strong>Backing up WordPress files<\/strong><\/p><p>To protect your WordPress site against data loss or corruption, you should back up both WordPress files and the database.<\/p><p>Since Docker mounts the WordPress directory as a volume, you can back up this directory using a simple command like this:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cp -r \/path\/to\/wordpress \/path\/to\/backup\/location<\/pre><p>To back up your MySQL database, run the following command. Replace <strong>[db_container_name]<\/strong>, <strong>[MYSQL_USER], [MYSQL_PASSWORD]<\/strong>, and <strong>[MYSQL_DATABASE]<\/strong> with your actual database container name and credentials:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec [db_container_name] \/usr\/bin\/mysqldump -u [MYSQL_USER] -p[MYSQL_PASSWORD] [MYSQL_DATABASE] &amp;gt; backup.sql<\/pre><p>This command creates a database dump, which you can restore later if needed.<\/p><p>Alternatively, Hostinger VPS customers can use our built-in backup tools to easily back up and restore data. To access these features, go to <strong>Backup &amp; Monitoring &rarr; Snapshots &amp; Backups<\/strong> in your VPS dashboard&rsquo;s left sidebar.<\/p><p>Then, choose to either create a snapshot to capture your current setup or restore previous data from an automated weekly backup.<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"6a5884e25ffc8\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a5884e25ffc8\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1864\" height=\"1486\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/hpanel-vps-snapshots-backups.png\/w=1024,h=1024,fit=scale-down\" alt=\"The Snapshots &amp; Backups menu in Hostinger's hPanel\" class=\"wp-image-118463\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/hpanel-vps-snapshots-backups.png\/w=1864,fit=scale-down 1864w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/hpanel-vps-snapshots-backups.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/hpanel-vps-snapshots-backups.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/hpanel-vps-snapshots-backups.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/hpanel-vps-snapshots-backups.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/11\/hpanel-vps-snapshots-backups.png\/w=1536,fit=scale-down 1536w\" sizes=\"(max-width: 1864px) 100vw, 1864px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n<\/div><p>\n\n        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Manage backups with Kodee                <\/p>\n            <\/div>\n            <p class=\"protip__content\">You can list available backups and manage backup schedule by simply asking <strong>Kodee<\/strong>. For example, ask, \"List available backups on my hostname.com VPS.\"<\/p>\n                    <\/div>\n        \n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>In this article, you&rsquo;ve learned how to install and configure WordPress using Docker on an Ubuntu VPS. From setting up Docker Compose to customizing for production environments, you now have a fully functional WordPress setup in a containerized environment.<\/p><p>After running WordPress using Docker, consider optimizing your site further, such as by using a content delivery network (CDN). You can also set up different Docker containers if you decide to host other applications on the same VPS.<\/p><p>If you have any questions or would like to share your experience developing WordPress websites with Docker, feel free to use the comment box below.<\/p><h2 class=\"wp-block-heading\" id=\"h-wordpress-docker-faq\">WordPress Docker FAQ<\/h2><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1730938301692\"><h3 class=\"schema-faq-question\">What are the benefits of using Docker for WordPress?<\/h3> <p class=\"schema-faq-answer\">With Docker, you can deploy and scale your WordPress environment as needed. Docker isolates dependencies, making it easier to update, back up, and migrate your WordPress site efficiently.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1730938312113\"><h3 class=\"schema-faq-question\">Can I run multiple WordPress sites on a single server with Docker?<\/h3> <p class=\"schema-faq-answer\">Yes, Docker lets you run multiple WordPress websites on a single server by using separate containers for each site. Set up each container with unique ports, volumes, and database connections for isolation.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1730938326166\"><h3 class=\"schema-faq-question\">How do I configure a WordPress Docker container?<\/h3> <p class=\"schema-faq-answer\">To configure a WordPress Docker container, use a Docker Compose file to define services, ports, and environment variables. For sensitive data, such as database credentials, we suggest storing it in a <strong>.env<\/strong> file linked to the Compose file.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Installing WordPress on an Ubuntu virtual private server (VPS) commonly requires LAMP (Linux, Apache, MySQL, PHP). However, you can also [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/tutorials\/run-docker-wordpress\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":411,"featured_media":87036,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to install WordPress on Docker","rank_math_description":"Learn how to install WordPress on Docker: 1. Install Docker 2. Set up a directory 3. Create a Compose file 4. Start the container + more.","rank_math_focus_keyword":"docker wordpress","footnotes":""},"categories":[22646,22644],"tags":[],"class_list":["post-4323","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pre-installed-applications","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/run-docker-wordpress","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/wordpress-docker","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/docker-wordpress","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/instalar-wordpress-en-docker","default":0},{"locale":"ja-JP","link":"https:\/\/www.hostinger.com\/jp\/tutorials\/run-docker-wordpress","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/run-docker-wordpress","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/run-docker-wordpress","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/run-docker-wordpress","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/instalar-wordpress-en-docker","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/instalar-wordpress-en-docker","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/instalar-wordpress-en-docker","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/wordpress-docker","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/run-docker-wordpress","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/run-docker-wordpress","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/run-docker-wordpress","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/run-docker-wordpress","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/4323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/users\/411"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/comments?post=4323"}],"version-history":[{"count":88,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/4323\/revisions"}],"predecessor-version":[{"id":131654,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/4323\/revisions\/131654"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media\/87036"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media?parent=4323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/categories?post=4323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/tags?post=4323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}