<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Installation Guide &#8211; Best DevOps</title>
	<atom:link href="https://www.bestdevops.com/tag/installation-guide/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.bestdevops.com</link>
	<description>Lets Learn, Do it &#38; Share! Thats a Best DevOps!!!</description>
	<lastBuildDate>Mon, 12 Oct 2026 07:26:40 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.3</generator>
	<item>
		<title>How to Install WordPress with Docker on Ubuntu</title>
		<link>https://www.bestdevops.com/how-to-install-wordpress-with-docker/</link>
					<comments>https://www.bestdevops.com/how-to-install-wordpress-with-docker/#respond</comments>
		
		<dc:creator><![CDATA[anil]]></dc:creator>
		<pubDate>Thu, 16 Mar 2017 15:24:47 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<category><![CDATA[DevOps Process]]></category>
		<category><![CDATA[DevOps Tools]]></category>
		<category><![CDATA[Container]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Docker Tutorials]]></category>
		<category><![CDATA[Installation Guide]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Installation With Docker]]></category>
		<category><![CDATA[Wordpress Tutorial]]></category>
		<guid isPermaLink="false">http://www.bestdevops.com/?p=949</guid>

					<description><![CDATA[Learn how to deploy a containerized WordPress site using Docker on Ubuntu. This step-by-step guide covers pulling the MariaDB and WordPress images, creating persistent storage volumes, linking containers, and completing the WordPress setup in your browser.]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Docker makes it straightforward to run self-contained applications without polluting the host system. WordPress is a perfect candidate: it needs a web server, PHP, and a database — all of which can be isolated in containers and wired together in minutes.</p>



<p class="wp-block-paragraph">This guide targets <strong>Ubuntu Server</strong> and assumes Docker is already installed and the <code>docker</code> daemon is running. If you still need to set Docker up, follow the official <a href="https://docs.docker.com/engine/install/ubuntu/">Docker Engine installation guide for Ubuntu</a> before continuing.</p>



<h2 class="wp-block-heading">Overview of the Approach</h2>



<p class="wp-block-paragraph">We will spin up two containers:</p>



<ul class="wp-block-list">
  <li><strong>MariaDB</strong> — stores the WordPress database, with data persisted to the host via a bind mount.</li>
  <li><strong>WordPress (official image)</strong> — runs Apache and PHP-FPM, connected to the database container, with the site files persisted to the host.</li>
</ul>



<p class="wp-block-paragraph">Data for both containers is stored under <code>/opt/wordpress</code> on the host so that it survives container restarts and upgrades.</p>



<h2 class="wp-block-heading">Step 1 — Create Persistent Storage Directories</h2>



<p class="wp-block-paragraph">Before starting any containers, create the directories that will hold the database files and WordPress HTML files:</p>


<pre class="wp-block-code"><span><code class="hljs">sudo mkdir -p /opt/wordpress/database
sudo mkdir -p /opt/wordpress/html</code></span></pre>


<h2 class="wp-block-heading">Step 2 — Pull and Run the MariaDB Container</h2>



<p class="wp-block-paragraph">Pull the latest MariaDB image:</p>


<pre class="wp-block-code"><span><code class="hljs">sudo docker pull mariadb</code></span></pre>


<p class="wp-block-paragraph">Then start the database container, passing in environment variables to configure the root password, a dedicated WordPress user, that user&#8217;s password, and the database name:</p>


<pre class="wp-block-code"><span><code class="hljs language-javascript">docker run \
  -e MYSQL_ROOT_PASSWORD=your_root_password \
  -e MYSQL_USER=wpuser \
  -e MYSQL_PASSWORD=your_wpuser_password \
  -e MYSQL_DATABASE=wordpress_db \
  -v /opt/wordpress/database:<span class="hljs-regexp">/var/</span>lib/mysql \
  --name wordpressdb \
  -d mariadb</code></span></pre>


<p class="wp-block-paragraph">Replace <code>your_root_password</code> and <code>your_wpuser_password</code> with strong, unique values. Docker will automatically create the <code>wpuser</code> account and the <code>wordpress_db</code> database on first run.</p>



<h3 class="wp-block-heading">Verify the Database Container</h3>



<p class="wp-block-paragraph">Find the internal IP address Docker assigned to the container:</p>


<pre class="wp-block-code"><span><code class="hljs language-javascript">docker inspect -f <span class="hljs-string">'{{ .NetworkSettings.IPAddress }}'</span> wordpressdb</code></span></pre>


<p class="wp-block-paragraph">You can optionally test connectivity by logging in with the MySQL client (install with <code>sudo apt install mysql-client</code> if needed):</p>


<pre class="wp-block-code"><span><code class="hljs language-xml">mysql -u wpuser -h <span class="hljs-tag">&lt;<span class="hljs-name">CONTAINER_IP</span>&gt;</span> -p</code></span></pre>


<p class="wp-block-paragraph">Enter the <code>wpuser</code> password when prompted. If the MySQL prompt appears, the database container is working correctly. Type <code>exit;</code> to leave the prompt.</p>



<h2 class="wp-block-heading">Step 3 — Pull and Run the WordPress Container</h2>



<p class="wp-block-paragraph">Pull the official WordPress image:</p>


<pre class="wp-block-code"><span><code class="hljs language-css"><span class="hljs-selector-tag">docker</span> <span class="hljs-selector-tag">pull</span> <span class="hljs-selector-tag">wordpress</span><span class="hljs-selector-pseudo">:latest</span></code></span></pre>


<p class="wp-block-paragraph">Start the WordPress container, linking it to the database container and mapping port <code>8081</code> on the host to port <code>80</code> inside the container:</p>


<pre class="wp-block-code"><span><code class="hljs language-javascript">docker run \
  -e WORDPRESS_DB_USER=wpuser \
  -e WORDPRESS_DB_PASSWORD=your_wpuser_password \
  -e WORDPRESS_DB_NAME=wordpress_db \
  -p <span class="hljs-number">8081</span>:<span class="hljs-number">80</span> \
  -v /opt/wordpress/html:<span class="hljs-regexp">/var/</span>www/html \
  --link wordpressdb:mysql \
  --name wpcontainer \
  -d wordpress</code></span></pre>


<p class="wp-block-paragraph">Key flags explained:</p>



<ul class="wp-block-list">
  <li><code>-e WORDPRESS_DB_*</code> — passes database credentials directly to the WordPress image&#8217;s entrypoint, which writes them into <code>wp-config.php</code> automatically.</li>
  <li><code>-p 8081:80</code> — exposes WordPress on port <code>8081</code> of the <em>host</em> machine.</li>
  <li><code>-v /opt/wordpress/html:/var/www/html</code> — persists WordPress files (themes, plugins, uploads) on the host.</li>
  <li><code>--link wordpressdb:mysql</code> — makes the database container reachable inside the WordPress container as the hostname <code>mysql</code>. Note: <code>--link</code> is a legacy Docker feature; see the note below about Docker Compose for a more maintainable alternative.</li>
</ul>



<h2 class="wp-block-heading">Step 4 — Complete the WordPress Installation</h2>



<p class="wp-block-paragraph">Open a browser and navigate to:</p>


<pre class="wp-block-code"><span><code class="hljs language-xml">http://<span class="hljs-tag">&lt;<span class="hljs-name">HOST_SERVER_IP</span>&gt;</span>:8081</code></span></pre>


<p class="wp-block-paragraph">Use the IP address of the <strong>host machine running Docker</strong>, not the internal container IP. The standard WordPress five-minute installation wizard will appear. Choose your language, set the site title, admin username, and admin password, and click <strong>Install WordPress</strong>.</p>



<h2 class="wp-block-heading">Managing Your Containers</h2>



<p class="wp-block-paragraph">A few useful commands once both containers are running:</p>



<figure class="wp-block-table"><table><thead><tr><th>Task</th><th>Command</th></tr></thead><tbody><tr><td>List running containers</td><td><code>docker ps</code></td></tr><tr><td>Stop WordPress</td><td><code>docker stop wpcontainer</code></td></tr><tr><td>Start WordPress</td><td><code>docker start wpcontainer</code></td></tr><tr><td>View WordPress logs</td><td><code>docker logs wpcontainer</code></td></tr><tr><td>Remove a container (data is safe in /opt/wordpress)</td><td><code>docker rm wpcontainer</code></td></tr></tbody></table></figure>



<h2 class="wp-block-heading">Consider Docker Compose for Production Use</h2>



<p class="wp-block-paragraph">The <code>--link</code> flag used above is considered legacy in modern Docker. For anything beyond a quick local test, use <strong>Docker Compose</strong> to define both services in a single <code>docker-compose.yml</code> file. Compose handles networking, dependency ordering, and restart policies more cleanly, and makes the whole stack reproducible from a single file. The official <a href="https://hub.docker.com/_/wordpress">WordPress Docker Hub page</a> includes a ready-to-use Compose example.</p>



<h2 class="wp-block-heading">Summary</h2>



<p class="wp-block-paragraph">With fewer than ten commands you can have a fully functional WordPress site running inside Docker containers, complete with persistent storage for both the database and the site files. Containers encapsulate the full stack, keep the host system clean, and make the deployment easy to move or recreate. For longer-term maintainability, migrate the setup to Docker Compose and consider adding an Nginx reverse proxy container to handle SSL termination.</p>

]]></content:encoded>
					
					<wfw:commentRss>https://www.bestdevops.com/how-to-install-wordpress-with-docker/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
