{"id":14603,"date":"2020-02-19T23:27:33","date_gmt":"2020-02-19T22:27:33","guid":{"rendered":"https:\/\/www.datanovia.com\/en\/?post_type=dt_lessons&#038;p=14603"},"modified":"2020-02-22T19:53:04","modified_gmt":"2020-02-22T18:53:04","slug":"docker-wordpress-production-deployment","status":"publish","type":"dt_lessons","link":"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/","title":{"rendered":"Docker WordPress Production Deployment"},"content":{"rendered":"<div id=\"rdoc\">\n<p>This tutorial provides a practical guide for <strong>Docker WordPress production deployment<\/strong>. You will learn how to deploy automatically WordPress on line using docker compose.<\/p>\n<p>The installation tool kit include:<\/p>\n<ul>\n<li><em>Nginx<\/em> server, reverse-proxy and <em>letsencrypt<\/em> for HTTPS certificates<\/li>\n<li><em>WordPress<\/em> files<\/li>\n<li><em>MariaDB\/MySQL<\/em> used for WordPress database<\/li>\n<li><em>phpMyAdmin<\/em> interface to connect to your MySQL database<\/li>\n<li><em>WP-Cli<\/em>: WordPress Command Line Interface<\/li>\n<li><em>Makefile<\/em> directives for automatization.<\/li>\n<\/ul>\n<p>Contents:<\/p>\n<div id=\"TOC\">\n<ul>\n<li><a href=\"#prerequisites\">Prerequisites<\/a><\/li>\n<li><a href=\"#step-1.-create-websites-directories\">Step 1. Create websites directories<\/a><\/li>\n<li><a href=\"#step-2.-download-a-nginx-proxy-web-server-template-for-hosting-multiple-websites-on-the-same-server\">Step 2. Download a nginx-proxy web server template for hosting multiple websites on the same server<\/a><\/li>\n<li><a href=\"#step-3.-download-a-wordpress-docker-compose-template\">Step 3. Download a WordPress docker-compose template<\/a><\/li>\n<li><a href=\"#step-4.-inspect-your-web-directory\">Step 4. Inspect your web directory<\/a><\/li>\n<li><a href=\"#step-5.-edit-the-wordpress-docker-setup-environment-variables\">Step 5. Edit the WordPress Docker setup environment variables<\/a><\/li>\n<li><a href=\"#step-6.-edit-the-docker-compose-configuration-file\">Step 6. Edit the docker-compose configuration file<\/a><\/li>\n<li><a href=\"#step-7.-run-the-nginx-reverse-proxy\">Step 7. Run the nginx reverse proxy<\/a><\/li>\n<li><a href=\"#step-8.-allow-users-to-post-large-documents-or-images\">Step 8. Allow users to post large documents or images<\/a><\/li>\n<li><a href=\"#step-9.-install-wordpress-using-docker-compose\">Step 9. Install WordPress using docker compose<\/a>\n<ul>\n<li><a href=\"#method-1.-automatic-installation-manual-configuration\">Method 1. Automatic installation + manual configuration<\/a><\/li>\n<li><a href=\"#method-2.-automatic-installation-and-configuration\">Method 2. Automatic installation and configuration<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#step-10.-access-to-your-website\">Step 10. Access to your website<\/a><\/li>\n<li><a href=\"#shutdown-and-cleanup\">Shutdown and cleanup<\/a><\/li>\n<li><a href=\"#summary\">Summary<\/a><\/li>\n<\/ul>\n<\/div>\n<div id=\"prerequisites\" class=\"section level2\">\n<h2>Prerequisites<\/h2>\n<ul>\n<li>Read this: <a href=\"https:\/\/www.datanovia.com\/en\/lessons\/wordpress-local-development-using-docker-compose\/\">WordPress Local Development Using Docker Compose<\/a><\/li>\n<li>Read also this: <a href=\"https:\/\/www.datanovia.com\/en\/lessons\/how-host-multiple-https-websites-on-one-server\/\">How to Host Multiple HTTPS Websites on One Server<\/a><\/li>\n<li>Git, docker and docker-compose are installed on your server<\/li>\n<li>Your host must be publicly reachable on both port <code>80<\/code> and <code>443<\/code>. <a href=\"https:\/\/www.datanovia.com\/en\/lessons\/digitalocean-initial-ubuntu-server-setup\/\">Check your firewall rules to make sure that these ports are open<\/a>.<\/li>\n<li><a href=\"https:\/\/www.datanovia.com\/en\/lessons\/how-to-create-a-website-directory-and-set-up-proper-permissions\/\">Create a website directory and set up proper permissions<\/a>. In this tutorial, we\u2019ll assume that the web directory is at <code>\/srv\/www<\/code><\/li>\n<li><a href=\"https:\/\/www.datanovia.com\/en\/lessons\/how-to-create-a-subdomain-on-digitalocean\/\">Create domains and subdomains<\/a>:\n<ul>\n<li>One for your WordPress website: <code>www.example.com<\/code><\/li>\n<li>One to access your word press database via phpMyadmin: <code>sql.eample.com<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/div>\n<div id=\"step-1.-create-websites-directories\" class=\"section level2\">\n<h2>Step 1. Create websites directories<\/h2>\n<p>Read more: <a href=\"https:\/\/www.datanovia.com\/en\/lessons\/how-to-create-a-website-directory-and-set-up-proper-permissions\/\">Create a website directory and set up proper permissions<\/a><\/p>\n<pre class=\"bash\"><code># 0. settings\r\nweb_dir=\/srv\/www\r\nmyusername=kassambara\r\n# 1. Create the website directory\r\nsudo mkdir -p $web_dir\r\n# 2. set your user as the owner\r\nsudo chown -R $myusername $web_dir\r\n# 3. set the web server as the group owner\r\nsudo chgrp -R www-data $web_dir\r\n# 4. 755 permissions for everything\r\nsudo chmod -R 755 $web_dir\r\n# 5. New files and folders inherit \r\n# group ownership from the parent folder\r\nchmod g+s $web_dir<\/code><\/pre>\n<\/div>\n<div id=\"step-2.-download-a-nginx-proxy-web-server-template-for-hosting-multiple-websites-on-the-same-server\" class=\"section level2\">\n<h2>Step 2. Download a nginx-proxy web server template for hosting multiple websites on the same server<\/h2>\n<pre class=\"bash\"><code># Download a nginx-proxy template\r\nweb_dir=\/srv\/www\r\ngit clone https:\/\/github.com\/kassambara\/nginx-multiple-https-websites-on-one-server $web_dir\r\n\r\n# Update nginx.tmpl: Nginx configuration file template\r\nrm -rf $web_dir\/nginx-proxy\/nginx.tmpl\r\ncurl -s https:\/\/raw.githubusercontent.com\/jwilder\/nginx-proxy\/master\/nginx.tmpl&gt; $web_dir\/nginx-proxy\/nginx.tmpl\r\n\r\n# Remove unnecessary files and folders\r\ncd $web_dir\r\nrm -rf your-website-one.com your-website-two.com README.Rmd .gitignore .Rbuildignore .git<\/code><\/pre>\n<p>The downloaded <code>nginx-proxy<\/code> folder contains a <code>docker-compose.yml<\/code> file. This will launch three services:<\/p>\n<ul>\n<li><code>nginx<\/code>: the nginx-reverse proxy, uses the default nginx image. The label is needed so that the letsencrypt container knows which nginx proxy container to use.<\/li>\n<li><code>nginx-gen<\/code>: uses the jwilder\/docker-gen image. Its command instruction will render a nginx configuration (based on nginx.tmpl) for each website \/ container added to the network.<\/li>\n<li><code>nginx-letsencrypt<\/code>: generates and renew the HTTPS certificates. Read more: <a href=\"https:\/\/www.datanovia.com\/en\/lessons\/how-host-multiple-https-websites-on-one-server\/\">How to Host Multiple HTTPS Websites on One Server<\/a>.<\/li>\n<\/ul>\n<p>All these services are bound to the <code>nginx-proxy<\/code> network.<\/p>\n<\/div>\n<div id=\"step-3.-download-a-wordpress-docker-compose-template\" class=\"section level2\">\n<h2>Step 3. Download a WordPress docker-compose template<\/h2>\n<p><strong>Download a template<\/strong> from Github at: <a href=\"https:\/\/github.com\/kassambara\/wordpress-docker-compose\">kassambara\/wordpress-docker-compose<\/a><\/p>\n<pre class=\"bash\"><code># Download a WordPress docker-compose template and\r\n# put it in a folder with the same name as your domain name\r\nyour_domain_name=www.example.com\r\ncd $web_dir\r\ngit clone https:\/\/github.com\/kassambara\/wordpress-docker-compose $your_domain_name\r\n\r\n# Change the online docker-compose file name\r\ncd $your_domain_name\r\nmv docker-compose-onlinehost.yml docker-compose.yml\r\n\r\n# Remove unnecessary files and folders\r\nrm -rf .git .gitignore<\/code><\/pre>\n<p><strong>Template directory tree<\/strong>:<\/p>\n<pre><code>www\/www.example.com\r\n\u251c\u2500\u2500 LICENSE\r\n\u251c\u2500\u2500 Makefile\r\n\u251c\u2500\u2500 README.md\r\n\u251c\u2500\u2500 config\r\n\u2502   \u2514\u2500\u2500 php.conf.ini\r\n\u251c\u2500\u2500 docker-compose.yml\r\n\u251c\u2500\u2500 mysql\r\n\u251c\u2500\u2500 wordpress\r\n\u251c\u2500\u2500 wp-auto-config.yml\r\n\u2514\u2500\u2500 wpcli\r\n    \u251c\u2500\u2500 Dockerfile\r\n    \u251c\u2500\u2500 Makefile\r\n    \u2514\u2500\u2500 entrypoint.sh<\/code><\/pre>\n<p><strong>Essential folders<\/strong>:<\/p>\n<ul>\n<li><strong>mysql<\/strong>: MySQL database files for MariaDB<\/li>\n<li><strong>wordpress<\/strong>: WordPress web files<\/li>\n<li><strong>wpcli<\/strong> contains a Dockerfile example to build WordPress CLI.<\/li>\n<\/ul>\n<p><strong>Essential files<\/strong>:<\/p>\n<ul>\n<li><strong>setup-onlinehost.sh<\/strong>: Automatically set online production environment variables.<\/li>\n<li><strong>.env<\/strong> file: contain the environment variables required for the wordpress installation<\/li>\n<li><strong>docker-compose.yml<\/strong>: WordPress docker compose application services<\/li>\n<li><strong>Makefile<\/strong>: Set of simple bash command lines to build, install and configure WordPress, as well as, to start and stop the docker containers.<\/li>\n<\/ul>\n<\/div>\n<div id=\"step-4.-inspect-your-web-directory\" class=\"section level2\">\n<h2>Step 4. Inspect your web directory<\/h2>\n<p>Your web directory should look like this:<\/p>\n<pre><code>www\r\n\u251c\u2500\u2500 README.md\r\n\u251c\u2500\u2500 nginx-proxy\r\n\u2502   \u251c\u2500\u2500 certs\r\n\u2502   \u251c\u2500\u2500 conf.d\r\n\u2502   \u251c\u2500\u2500 docker-compose.yml\r\n\u2502   \u251c\u2500\u2500 html\r\n\u2502   \u251c\u2500\u2500 nginx.tmpl\r\n\u2502   \u2514\u2500\u2500 vhost.d\r\n\u2514\u2500\u2500 www.example.com\r\n    \u251c\u2500\u2500 LICENSE\r\n    \u251c\u2500\u2500 Makefile\r\n    \u251c\u2500\u2500 README.md\r\n    \u251c\u2500\u2500 config\r\n    \u251c\u2500\u2500 docker-compose.yml\r\n    \u251c\u2500\u2500 mysql\r\n    \u251c\u2500\u2500 wordpress\r\n    \u251c\u2500\u2500 wp-auto-config.yml\r\n    \u2514\u2500\u2500 wpcli<\/code><\/pre>\n<\/div>\n<div id=\"step-5.-edit-the-wordpress-docker-setup-environment-variables\" class=\"section level2\">\n<h2>Step 5. Edit the WordPress Docker setup environment variables<\/h2>\n<pre class=\"bash\"><code># 1. Open the setup file\r\nnano $web_dir\/$your_domain_name\/setup-onlinehost.sh\r\n\r\n# 2. Change these settings as you want \r\nproject_name=\"wordpress\"\r\nuser_name=\"wordpress\"\r\npass_word=\"wordpress\"\r\nemail=\"your-email@example.com\"\r\nwebsite_title=\"My Blog\"\r\nwebsite_url=\"https:\/\/www.example.com\"\r\nphmyadmin_url=\"sql.example.com\"\r\nenv_file=\".env\"\r\ncompose_file=\"docker-compose.yml\"\r\n\r\n# 3. Execute: \r\nchmod +x setup-onlinehost.sh &amp;&amp; .\/setup-onlinehost.sh <\/code><\/pre>\n<p>An automatically updated <code>.env<\/code> file is available to easily set docker-compose variables without having to modify too much the <code>docker-compose.yml<\/code> configuration file itself.<\/p>\n<p><strong>Open the <code>.env<\/code> file and update the contents<\/strong> if you want. In our example, the file is located at <code>www\/www.example.com\/.env<\/code><\/p>\n<pre class=\"bash\"><code># Open the file\r\nnano $web_dir\/$your_domain_name\/.env<\/code><\/pre>\n<p><strong>Contents<\/strong>:<\/p>\n<pre class=\"bash\"><code># 1\/ Project name -------------------------------------------------\r\n# Must be lower-case, no spaces and no invalid path chars.\r\n# Will be used also as the WP database name\r\nCOMPOSE_PROJECT_NAME=wordpress\r\n\r\n# 2\/ Database user and password -----------------------------------------\r\n# Set non-root database user if wanted (optional)\r\nDATABASE_PASSWORD=password\r\nDATABASE_USER=root\r\n\r\n# 3\/ For wordpress auto-install and auto-configuration -------------------\r\nWORDPRESS_WEBSITE_TITLE=\"My Blog\"\r\n\r\n# URL: Use this for localhost\r\nWORDPRESS_WEBSITE_URL=\"https:\/\/www.example.com\"\r\nWORDPRESS_WEBSITE_URL_WITHOUT_HTTP=\"www.example.com\"\r\nWORDPRESS_WEBSITE_POST_URL_STRUCTURE=\"\/blog\/%postname%\/\"\r\n\r\n# Website admin identification. Specify a strong password \r\nWORDPRESS_ADMIN_USER=\"wordpress\"\r\nWORDPRESS_ADMIN_PASSWORD=\"wordpress\"\r\nWORDPRESS_ADMIN_EMAIL=\"your-email@example.com\"\r\n\r\n# 4\/ Software versions -----------------------------------------------\r\nWORDPRESS_VERSION=latest\r\nMARIADB_VERSION=latest\r\n\r\n# 5\/ Ports: Can be changed -------------------------------------------\r\nPHPMYADMIN_PORT=8080\r\n\r\n# 6\/ Volumes on host --------------------------------------------------\r\nWORDPRESS_DATA_DIR=.\/wordpress\r\n\r\n# 7\/ Healthcheck availability of host services (mysql and woordpress server)\r\n# Waiting time in second\r\nWAIT_BEFORE_HOSTS=5\r\nWAIT_AFTER_HOSTS=5\r\nWAIT_HOSTS_TIMEOUT=300\r\nWAIT_SLEEP_INTERVAL=60\r\nWAIT_HOST_CONNECT_TIMEOUT=5\r\n\r\n# 8\/ Used only in online deployement ---------------------------------\r\nWORDPRESS_WEBSITE_URL_WITHOUT_WWW=example.com\r\nPHPMYADMIN_WEBSITE_URL_WITHOUT_HTTP=sql.example.com<\/code><\/pre>\n<div class=\"block\">\n<p>Click here to <a href=\"https:\/\/www.datanovia.com\/en\/lessons\/wordpress-docker-setup-files-example-for-local-development\">inspect the content of configuration files<\/a><\/p>\n<\/div>\n<\/div>\n<div id=\"step-6.-edit-the-docker-compose-configuration-file\" class=\"section level2\">\n<h2>Step 6. Edit the docker-compose configuration file<\/h2>\n<p>Inspect and update the<code>$web_dir\/$your_domain_name\/docker-compose.yml<\/code> file if you want. It contains a container that redirect non-www to www (recommended). If you don\u2019t want this behaviour, just remove the container.<\/p>\n<pre class=\"bash\"><code>....\r\n# Redirect non-www to www\r\n  redirectnonwww:\r\n    image: cusspvz\/redirect\r\n    container_name: ${COMPOSE_PROJECT_NAME}_redirectnonwww\r\n    restart: always\r\n    environment:\r\n      - VIRTUAL_HOST=${WORDPRESS_WEBSITE_URL_WITHOUT_WWW}\r\n      - HTTPS_METHOD=noredirect\r\n      - LETSENCRYPT_HOST=${WORDPRESS_WEBSITE_URL_WITHOUT_WWW}\r\n      - LETSENCRYPT_EMAIL=${WORDPRESS_ADMIN_EMAIL}\r\n      - REDIRECT=${WORDPRESS_WEBSITE_URL}\r\n      # CHANGE THE REDIRECT URL\r\n      - REDIRECT=https:\/\/www.example.com\r\n      - WORKER_CONNECTIONS=1024\r\n    networks:\r\n      - ${COMPOSE_PROJECT_NAME}_default\r\n      - nginx-proxy\r\n.....<\/code><\/pre>\n<\/div>\n<div id=\"step-7.-run-the-nginx-reverse-proxy\" class=\"section level2\">\n<h2>Step 7. Run the nginx reverse proxy<\/h2>\n<pre class=\"bash\"><code># 1. Create the docker network. Do this once\r\ndocker network create nginx-proxy\r\n\r\n# 2. Create the reverse proxy with the \r\n# nginx, nginx-gen and nginx-letsencrypt containers\r\ncd $web_dir\/nginx-proxy\/\r\ndocker-compose up -d<\/code><\/pre>\n<\/div>\n<div id=\"step-8.-allow-users-to-post-large-documents-or-images\" class=\"section level2\">\n<h2>Step 8. Allow users to post large documents or images<\/h2>\n<div class=\"warning\">\n<p>In the Nginx configuration file, you need also to increase <code>client_max_body_size<\/code> to allow users to post large documents. You can add for example the line <code>client_max_body_size 64M;<\/code> in the server{} directive.<\/p>\n<\/div>\n<pre class=\"bash\"><code># 1. Create a configuration file for your domain\r\n# in the nginx-proxy vhost folder\r\nnano $web_dir\/nginx-proxy\/vhost.d\/$your_domain_name\r\n\r\n# 2. Add this to allow the upload of 64M\r\nclient_max_body_size 64M;<\/code><\/pre>\n<p>One single command to do the above operation:<\/p>\n<pre class=\"bash\"><code>echo 'client_max_body_size 64M;' &gt; nano $web_dir\/nginx-proxy\/vhost.d\/$your_domain_name<\/code><\/pre>\n<\/div>\n<div id=\"step-9.-install-wordpress-using-docker-compose\" class=\"section level2\">\n<h2>Step 9. Install WordPress using docker compose<\/h2>\n<p>Two methods are available for installing and configuring your WordPress web site:<\/p>\n<ol style=\"list-style-type: decimal;\">\n<li>Automatic installation + manual configuration<\/li>\n<li>Automatic installation + automatic configuration<\/li>\n<\/ol>\n<div id=\"method-1.-automatic-installation-manual-configuration\" class=\"section level3\">\n<h3>Method 1. Automatic installation + manual configuration<\/h3>\n<div id=\"automatic-installation-of-wordpress-in-docker\" class=\"section level4\">\n<h4>Automatic installation of WordPress in docker<\/h4>\n<p>Three lines of <code>docker-compose<\/code> commands:<\/p>\n<ol style=\"list-style-type: decimal;\">\n<li>Build docker application images<\/li>\n<li>Start wordpress installation in detached mode<\/li>\n<li>(Health)Check the availability of WordPress docker services<\/li>\n<\/ol>\n<p>Go into your domaine name folder and type this:<\/p>\n<pre class=\"bash\"><code>cd $your_domain_name\r\ndocker-compose build\r\ndocker-compose up -d \r\ndocker-compose run --rm healthcheck<\/code><\/pre>\n<p>Explaining the different docker compose options:<\/p>\n<ul>\n<li><code>-d<\/code>: start containers in detached options<\/li>\n<li><code>--rm<\/code>: remove containers when stopped<\/li>\n<\/ul>\n<p>Alternatively, you can also use the following <code>make<\/code> shortcut commands. Easy to use on Unix operating systems (MAC and Linux)<\/p>\n<pre class=\"bash\"><code>cd $your_domain_name\r\nmake install<\/code><\/pre>\n<p>Console logs look like this:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/docker-compose-wordpress-woocommerce-and-wp-cli\/images\/wordpress-docker-compose-008-installation-done.png\" alt=\"Console logs\" \/><\/p>\n<\/div>\n<div id=\"manual-wordpress-configuration\" class=\"section level4\">\n<h4>Manual WordPress configuration<\/h4>\n<p>Navigate your browser to www.example.com and follow the installation prompts<\/p>\n<ol style=\"list-style-type: decimal;\">\n<li><strong>Set WordPress language<\/strong><\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/docker-compose-wordpress-woocommerce-and-wp-cli\/images\/wordpress-docker-compose-001-language.png\" alt=\"Select WordPress language\" \/><\/p>\n<ol style=\"list-style-type: decimal;\" start=\"2\">\n<li><strong>Create an administrative user<\/strong><\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/docker-compose-wordpress-woocommerce-and-wp-cli\/images\/wordpress-docker-compose-002-admin-user.png\" alt=\"Create an administrative user\" \/><\/p>\n<ol style=\"list-style-type: decimal;\" start=\"3\">\n<li><strong>Success<\/strong><\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/docker-compose-wordpress-woocommerce-and-wp-cli\/images\/wordpress-docker-compose-003-success.png\" alt=\"Installation success\" \/><\/p>\n<ol style=\"list-style-type: decimal;\" start=\"4\">\n<li><strong>Log in as the administrative user<\/strong><\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/docker-compose-wordpress-woocommerce-and-wp-cli\/images\/wordpress-docker-compose-004-login.png\" alt=\"Login as admin\" \/><\/p>\n<ol style=\"list-style-type: decimal;\" start=\"5\">\n<li><strong>Admin dashboard<\/strong><\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/docker-compose-wordpress-woocommerce-and-wp-cli\/images\/wordpress-docker-compose-005-dashbord.png\" alt=\"Admin dashbord\" \/><\/p>\n<\/div>\n<\/div>\n<div id=\"method-2.-automatic-installation-and-configuration\" class=\"section level3\">\n<h3>Method 2. Automatic installation and configuration<\/h3>\n<p>Before, re-trying the installation, first clean up everything as follow:<\/p>\n<pre class=\"bash\"><code>docker-compose down\r\nrm -rf mysql\/* wordpress\/*<\/code><\/pre>\n<p>The following <code>docker-compose<\/code> or <code>make<\/code> commands can be used to automatically install and configure wordpress.<\/p>\n<p>Using the <code>docker-compose<\/code> commands.<\/p>\n<pre class=\"bash\"><code># Build docker images and start up wordpress\r\ndocker-compose up -d --build\r\n# Automatic wordpress configuration\r\ndocker-compose -f docker-compose.yml -f wp-auto-config.yml run --rm wp-auto-config<\/code><\/pre>\n<p>Using the <code>make<\/code> commands. For Unix systems (MAC and Linux) users:<\/p>\n<pre class=\"bash\"><code>make autoinstall<\/code><\/pre>\n<\/div>\n<\/div>\n<div id=\"step-10.-access-to-your-website\" class=\"section level2\">\n<h2>Step 10. Access to your website<\/h2>\n<ol style=\"list-style-type: decimal;\">\n<li>Visit your wordpress website at www.example.com. Default identification for admin (www.example.com\/wp-login.php):\n<ul>\n<li><code>Username: wordpress<\/code> and<\/li>\n<li><code>Password: wordpress<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/docker-compose-wordpress-woocommerce-and-wp-cli\/images\/wordpress-docker-compose-006-website.png\" alt=\"Website\" \/><\/p>\n<div class=\"success\">\n<p>Once your site is running you can begin to create and publish any content you\u2019d like in your WordPress instance.<\/p>\n<\/div>\n<ol style=\"list-style-type: decimal;\" start=\"2\">\n<li>Visit your database via phpMyAdmin at <a class=\"uri\" href=\"http:\/\/sql.example.com\">http:\/\/sql.example.com<\/a>\n<ul>\n<li><code>Username: root<\/code> and<\/li>\n<li><code>Password: password<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/docker-compose-wordpress-woocommerce-and-wp-cli\/images\/wordpress-docker-compose-007-phpmyadmin.png\" alt=\"phpMyAdmin\" \/><\/p>\n<\/div>\n<div id=\"shutdown-and-cleanup\" class=\"section level2\">\n<h2>Shutdown and cleanup<\/h2>\n<p>This section present useful set of commands to know.<\/p>\n<ol style=\"list-style-type: decimal;\">\n<li><strong>Shutdown WordPress docker containers and dependencies<\/strong>. The command <code>docker-compose down<\/code> removes the containers and default network, but preserves your WordPress database.<\/li>\n<\/ol>\n<pre class=\"bash\"><code># Stop and remove containers\r\ndocker-compose down<\/code><\/pre>\n<ol style=\"list-style-type: decimal;\" start=\"2\">\n<li><strong>(Re)start WordPress docker compose containers<\/strong><\/li>\n<\/ol>\n<pre class=\"bash\"><code>docker-compose up -d<\/code><\/pre>\n<ol style=\"list-style-type: decimal;\" start=\"3\">\n<li><strong>Reset<\/strong> or reinitialize everything<\/li>\n<\/ol>\n<ul>\n<li>Stop and remove containers<\/li>\n<li>Remove related wordpress and mysql installed files<\/li>\n<\/ul>\n<pre class=\"bash\"><code>docker-compose down\r\nrm -rf mysql\/* wordpress\/*<\/code><\/pre>\n<div class=\"warning\">\n<p>Note that, instead of using the above <code>docker-compose<\/code> commands, you can also use easily the following <code>make<\/code> shortcut command lines if you have Unix systems (MAC \/ Linux).<\/p>\n<\/div>\n<pre class=\"bash\"><code># Build, and start the wordpress website\r\nmake start\r\n# Stop and remove wordpress docker containers\r\nmake down\r\n# Reset everything\r\nmake reset<\/code><\/pre>\n<\/div>\n<div id=\"summary\" class=\"section level2\">\n<h2>Summary<\/h2>\n<p>This tutorial provides a practical guide for <strong>Docker WordPress production deployment<\/strong>.<\/p>\n<\/div>\n<\/div>\n<p><!--end rdoc--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Provides a practical guide for Docker Wordpress production deployment.<\/p>\n","protected":false},"author":1,"featured_media":9165,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","class_list":["post-14603","dt_lessons","type-dt_lessons","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Docker Wordpress Production Deployment - Datanovia<\/title>\n<meta name=\"description\" content=\"Provides a practical guide for Docker Wordpress production deployment.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker Wordpress Production Deployment - Datanovia\" \/>\n<meta property=\"og:description\" content=\"Provides a practical guide for Docker Wordpress production deployment.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/\" \/>\n<meta property=\"og:site_name\" content=\"Datanovia\" \/>\n<meta property=\"article:modified_time\" content=\"2020-02-22T18:53:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040227.JPG.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/\",\"name\":\"Docker Wordpress Production Deployment - Datanovia\",\"isPartOf\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040227.JPG.jpg\",\"datePublished\":\"2020-02-19T22:27:33+00:00\",\"dateModified\":\"2020-02-22T18:53:04+00:00\",\"description\":\"Provides a practical guide for Docker Wordpress production deployment.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/#primaryimage\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040227.JPG.jpg\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040227.JPG.jpg\",\"width\":1024,\"height\":512},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.datanovia.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Lessons\",\"item\":\"https:\/\/www.datanovia.com\/en\/lessons\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Docker WordPress Production Deployment\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"name\":\"Datanovia\",\"description\":\"Data Mining and Statistics for Decision Support\",\"publisher\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.datanovia.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\",\"name\":\"Datanovia\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"width\":98,\"height\":99,\"caption\":\"Datanovia\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Docker Wordpress Production Deployment - Datanovia","description":"Provides a practical guide for Docker Wordpress production deployment.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/","og_locale":"en_US","og_type":"article","og_title":"Docker Wordpress Production Deployment - Datanovia","og_description":"Provides a practical guide for Docker Wordpress production deployment.","og_url":"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/","og_site_name":"Datanovia","article_modified_time":"2020-02-22T18:53:04+00:00","og_image":[{"width":1024,"height":512,"url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040227.JPG.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/","url":"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/","name":"Docker Wordpress Production Deployment - Datanovia","isPartOf":{"@id":"https:\/\/www.datanovia.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/#primaryimage"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/#primaryimage"},"thumbnailUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040227.JPG.jpg","datePublished":"2020-02-19T22:27:33+00:00","dateModified":"2020-02-22T18:53:04+00:00","description":"Provides a practical guide for Docker Wordpress production deployment.","breadcrumb":{"@id":"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/#primaryimage","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040227.JPG.jpg","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040227.JPG.jpg","width":1024,"height":512},{"@type":"BreadcrumbList","@id":"https:\/\/www.datanovia.com\/en\/lessons\/docker-wordpress-production-deployment\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.datanovia.com\/en\/"},{"@type":"ListItem","position":2,"name":"Lessons","item":"https:\/\/www.datanovia.com\/en\/lessons\/"},{"@type":"ListItem","position":3,"name":"Docker WordPress Production Deployment"}]},{"@type":"WebSite","@id":"https:\/\/www.datanovia.com\/en\/#website","url":"https:\/\/www.datanovia.com\/en\/","name":"Datanovia","description":"Data Mining and Statistics for Decision Support","publisher":{"@id":"https:\/\/www.datanovia.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.datanovia.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.datanovia.com\/en\/#organization","name":"Datanovia","url":"https:\/\/www.datanovia.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","width":98,"height":99,"caption":"Datanovia"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/"}}]}},"multi-rating":{"mr_rating_results":[]},"_links":{"self":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons\/14603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons"}],"about":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/types\/dt_lessons"}],"author":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/comments?post=14603"}],"version-history":[{"count":1,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons\/14603\/revisions"}],"predecessor-version":[{"id":14707,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons\/14603\/revisions\/14707"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media\/9165"}],"wp:attachment":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media?parent=14603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}