<?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>Docker | TekCookie</title>
	<atom:link href="https://tekcookie.com/category/docker/feed/" rel="self" type="application/rss+xml" />
	<link>https://tekcookie.com</link>
	<description>Everything about IT</description>
	<lastBuildDate>Thu, 25 Nov 2021 07:22:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/06/cropped-TekCookie-211.png?fit=32%2C17&#038;ssl=1</url>
	<title>Docker | TekCookie</title>
	<link>https://tekcookie.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">174510684</site>	<item>
		<title>WordPress website using Docker</title>
		<link>https://tekcookie.com/wordpress-website-using-docker/</link>
					<comments>https://tekcookie.com/wordpress-website-using-docker/#respond</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Thu, 25 Nov 2021 07:22:48 +0000</pubDate>
				<category><![CDATA[Containers]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://tekcookie.com/?p=4897</guid>

					<description><![CDATA[Introduction In this article, we will see how to setup a WordPress website using Docker. Containerization has changed the face of how the applications are packaged and deployed. WordPress hosting using docker containers makes it easy to host and manage the hosting. For setting up the website, a WordPress container and a SQL database container [&#8230;]]]></description>
										<content:encoded><![CDATA[				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-832561c7     "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							Table Of Contents						</div>
																<div class="uagb-toc__list-wrap">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#introduction" class="uagb-toc-link__trigger">Introduction</a><li class="uagb-toc__list"><a href="#prerequisites" class="uagb-toc-link__trigger">Prerequisites</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#docker-engine-installation" class="uagb-toc-link__trigger">Docker engine installation</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#docker-compose-installation" class="uagb-toc-link__trigger">Docker-Compose installation</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#docker-network-configuration" class="uagb-toc-link__trigger">Docker network configuration</a></li></ul></li><li class="uagb-toc__list"><a href="#wordpress-and-mariadb-installation" class="uagb-toc-link__trigger">WordPress and MariaDB Installation</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#create-necessary-folders" class="uagb-toc-link__trigger">Create necessary folders</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#wordpress-docker-compose-yaml" class="uagb-toc-link__trigger">WordPress Docker Compose YAML</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#powering-up-the-docker-containers" class="uagb-toc-link__trigger">Powering UP the docker containers</a></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#summary" class="uagb-toc-link__trigger">Summary</a></ul></ul></ol>					</div>
									</div>
				</div>
			


<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



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



<p>In this article, we will see how to setup a WordPress website using Docker. Containerization has changed the face of how the applications are packaged and deployed. WordPress hosting using docker containers makes it easy to host and manage the hosting.</p>



<p>For setting up the website, a WordPress container and a SQL database container are required. As we are using the containers, configurations can be fed into the containers during the creation by defining them in the Docker compose file.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



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



<p>A host with docker engine and docker-compose installed.</p>



<p>Here we are using Ubuntu 20.04 as the host. Docker and Docker-compose packages are installed using the below code.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Docker engine installation</h3>



<p>The latest stable version of the docker can be installed by executing just 2 lines of code in your Linux shell. Detailed documentation is available at&nbsp;<a href="https://docs.docker.com/engine/install/ubuntu/" target="_blank" rel="noreferrer noopener">https://docs.docker.com/engine/install/ubuntu/</a></p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh</code></pre>



<p>Add the current user (user ubuntu in my case) to the docker group</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo usermod -aG docker ubuntu</code></pre>



<p>Close the session and re-login for the user to update the permission</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Docker-Compose installation</h3>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo apt install docker-compose -y</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Docker network configuration</h3>



<p>Two networks are defined for separating the web traffic and database connection.</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo docker network create --subnet 10.10.10.0/24 data_default
sudo docker network create --subnet 10.10.11.0/24 proxy_default</code></pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">WordPress and MariaDB Installation</h2>



<p>As Docker loses its knowledge of data on reboot, the WordPress and the DB data has to be stored in a persistent storage (i.e. in a storage).</p>



<p></p>



<p>Following are the configuration details:</p>



<p><strong>WordPress</strong>:</p>



<ul class="wp-block-list"><li>Container name &#8211; testweb_wp</li><li>local data folder &#8216;/opt/data/wp_testweb/html&#8217; mapped to the wordpress container instance at &#8216;/var/www/html&#8217;</li><li>container port 80 is mapped to host port 8089</li><li>The container runs with the user account ubuntu with pid 1001(check your account puid and pgid and provide the number accordingly)</li><li>WordPress container connects to 2 bridge networks proxy_nw &gt;&gt; proxy_default and hosts_nw &gt;. data_default</li><li>and the configurations to connect to the database</li></ul>



<p><strong>MariaDB</strong>:</p>



<ul class="wp-block-list"><li>Container name &#8211; testweb_db_host</li><li>There is no port mapping to the host machine as the it communicates internally to the wordpress container</li><li>local data folder &#8216;/opt/data/wp_test/db&#8217; mapped to database container instance at &#8216;/config&#8217;</li></ul>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Create necessary folders</h3>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo mkdir /opt/data/ /opt/data/wp_testweb/ /opt/data/wp_testweb/html/ /opt/data/wp_testweb/db/</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">WordPress Docker Compose YAML</h3>



<p>Create yaml file</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">cd /opt/data/wp_testweb/
sudo touch docker-compose.yaml</code></pre>



<p>Use any text editor and add the following yaml code to the docker-compose file</p>



<pre class="wp-block-code"><code lang="yaml" class="language-yaml">version: '2'
services:
  testweb_db_host:
    image: linuxserver/mariadb:latest
    networks:
      - hosts_nw
    volumes:
      - /opt/data/wp_testweb/db:/config
    environment:
      - PUID=1001
      - PGID=1001
      - MYSQL_USER=wp_user
      - MYSQL_DATABASE=testweb_db
      - MYSQL_PASSWORD=Sup35ComplexPass
      - MYSQL_ROOT_PASSWORD=^3ryComplexPass
    restart: unless-stopped
  testweb_wp:
    image: wordpress:latest
    networks:
      - proxy_nw
      - hosts_nw
    ports:
      - 8089:80
    volumes:
      - '/opt/data/wp_testweb/html:/var/www/html'
    depends_on:
      - testweb_db
    environment:
      - PUID=1001
      - PGID=1001
      - WORDPRESS_DB_HOST=testweb_db_host
      - WORDPRESS_DB_USER=wp_user
      - WORDPRESS_DB_NAME=testweb_db
      - WORDPRESS_DB_PASSWORD=Sup35ComplexPass
    restart: unless-stopped

networks:
  proxy_nw:
    external: true
    name: proxy_default
  hosts_nw:
    external: true
    name: data_default</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Powering UP the docker containers</h3>



<p>The above configuration is to be saved as docker-compose.yaml and run following command from the saved folder.</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">docker-compose up -d</code></pre>



<p>If your docker-compose fails with the following error,</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">ERROR: The Compose file './docker-compose.yaml' is invalid because:
networks.hosts_nw value Additional properties are not allowed ('name' was unexpected)
networks.proxy_nw value Additional properties are not allowed ('name' was unexpected)</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p>The docker-compose has to be upgraded to the latest version. The latest stable version is now v2.1.1</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo curl -L https://github.com/docker/compose/releases/download/v2.1.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Reboot the server for the changes to take effect and install the package  gnome-keyring </p>



<pre class="wp-block-code"><code lang="bash" class="language-bash"># To reboot the server
sudo reboot</code></pre>



<pre class="wp-block-code"><code lang="bash" class="language-bash"># Install gnome-keyring package
sudo apt install gnome-keyring</code></pre>



<p>Now execute the command again &#8220;docker-compose up -d&#8221;</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



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



<p>Now the containers are up and running. Verify with the command &#8221; docker ps&#8221;</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">ubuntu@dockhost:/opt/data/wp_testweb$ docker ps
CONTAINER ID   IMAGE                        COMMAND                  CREATED          STATUS          PORTS                                   NAMES
46ae07cacda9   linuxserver/mariadb:latest   "/init"                  21 seconds ago   Up 17 seconds   3306/tcp                                wp_testweb-testweb_db_host-1
15c2f3ac5099   wordpress:latest             "docker-entrypoint.s…"   23 seconds ago   Up 16 seconds   0.0.0.0:8089->80/tcp, :::8089->80/tcp   wp_testweb-testweb_wp-1</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Open any web browser and access the URL http://&lt;ipaddress>:8089/</p>



<figure class="wp-block-image size-full is-resized"><img fetchpriority="high" decoding="async" src="//i2.wp.com/tekcookie.com/wp-content/uploads/2021/11/image-2.png" alt="" class="wp-image-4960" width="368" height="410" srcset="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/11/image-2.png?w=728&amp;ssl=1 728w, https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/11/image-2.png?resize=269%2C300&amp;ssl=1 269w" sizes="(max-width: 368px) 100vw, 368px" /></figure>



<p>Well, you have your wordpress running !</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Hope you like this article and thank you for reading.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/wordpress-website-using-docker/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4897</post-id>	</item>
		<item>
		<title>Self Host BookStack using Docker</title>
		<link>https://tekcookie.com/self-host-bookstack-using-docker/</link>
					<comments>https://tekcookie.com/self-host-bookstack-using-docker/#comments</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Sun, 14 Nov 2021 11:17:21 +0000</pubDate>
				<category><![CDATA[Containers]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://tekcookie.com/?p=4862</guid>

					<description><![CDATA[For any industry, IT or non-IT, Information or data is the key. There are various ways by which the information can be stored. Financial or structured data usually takes a table form and resides in a database. In the case of the non-structured generic data such as project documentation, knowledge base or personal documentation can [&#8230;]]]></description>
										<content:encoded><![CDATA[				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-63d8b968     "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							Table Of Contents						</div>
																<div class="uagb-toc__list-wrap">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#introduction" class="uagb-toc-link__trigger">Introduction</a><li class="uagb-toc__list"><a href="#prerequisites" class="uagb-toc-link__trigger">Prerequisites</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#linux-server" class="uagb-toc-link__trigger">Linux Server</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#docker-engine-installation" class="uagb-toc-link__trigger">Docker Engine Installation</a></li></ul></li><li class="uagb-toc__list"><a href="#bookstack-installation" class="uagb-toc-link__trigger">Bookstack Installation</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#docker-network-configuration" class="uagb-toc-link__trigger">Docker Network configuration</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#database-installation" class="uagb-toc-link__trigger">Database Installation</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#bookstack-installation" class="uagb-toc-link__trigger">BookStack Installation</a></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#final-steps" class="uagb-toc-link__trigger">Final Steps</a></ul></ul></ol>					</div>
									</div>
				</div>
			


<p>For any industry, IT or non-IT, Information or data is the key. There are various ways by which the information can be stored. Financial or structured data usually takes a table form and resides in a database. In the case of the non-structured generic data such as project documentation, knowledge base or personal documentation can be maintained well using a documentation platform rather than keeping it in files.</p>



<p>By keeping these informations in a platform, it is very easy to manage, edit, search the content as compared to the handling of files.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



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



<p>There are many such platforms out in the market which we can use. Confluence by Atlassian is one such feature-rich platform. It also does provide a free edition with 2GB storage. If you like to keep all your data with you, self hosting will be best option.</p>



<p>Of all the products, <a href="https://www.bookstackapp.com/" target="_blank" rel="noreferrer noopener">BookStack</a> is the one which I like the most. Bookstack is free and open source and the page editor has a simple WYSIWYG interface. BookStack has a very simple interface and all content can be broken down into Shelf, Books, Chapters, and Pages. It has built-in diagrams.net for easy creation of diagrams and many more.</p>



<p>In this article, we will discuss how to self-host BookStack in docker.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



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



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Linux Server</h3>



<p>The prerequisite is to have a Linux OS either in a public cloud or in your home server. Here I am using Ubuntu 20.04.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Docker Engine Installation</h3>



<p>The latest stable version of the docker can be installed by executing just 2 lines of code in your Linux shell. Detailed documentation is available at <a href="https://docs.docker.com/engine/install/ubuntu/" target="_blank" rel="noreferrer noopener"><span style="text-decoration: underline;">https://docs.docker.com/engine/install/ubuntu/</span></a></p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh</code></pre>



<p>Add the current user (user ubuntu in my case) to the docker group</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo usermod -aG docker ubuntu</code></pre>



<p>Close the session and re-login for the user to update the permission</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Bookstack Installation</h2>



<p>Bookstack uses a SQL database to store the data. We use MariaDB as our database. Both the BookStack and MariaDB docker container images are from <a href="https://www.linuxserver.io/" target="_blank" rel="noreferrer noopener"><span style="text-decoration: underline;">https://www.linuxserver.io/</span></a></p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Docker Network configuration</h3>



<p>Let&#8217;s create a network the containers</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo docker network create --subnet 10.10.10.0/24 data_default</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Database Installation</h3>



<p>Execute the below docker command to install the DB container.</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">docker run -d \
--name=bookstackdb \
-e PUID=1001 \
-e PGID=1001 \
-e MYSQL_ROOT_PASSWORD=pass123456 \
-e MYSQL_DATABASE=bookstackapp \
-e MYSQL_USER=bookstackuser \
-e MYSQL_PASSWORD=pass123456997 \
-v /opt/data/bookstack/db:/config \
--restart unless-stopped \
--network=data_default \
linuxserver/mariadb</code></pre>



<p>Running the above command will download the MariaDB image and create a container from the repository and run it with the specified configuration as mentioned in the environment variables. The container will be attached to the data_default network with the name bookstackdb.</p>



<p>The data folder will be created  &#8220;/opt/data/bookstack/db&#8221; if not already exist.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">BookStack Installation</h3>



<p> Execute the below docker command to install the BookStack container</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">docker run -d \
--name=bookstack \
-e PUID=1001 \
-e PGID=1001 \
-e DB_HOST=bookstackdb \
-e DB_USER=bookstackuser \
-e DB_PASS=pass123456997  \
-e DB_DATABASE=bookstackapp \
-e APP_URL=http://wiki.yourdomain.com:5865 \
-p 5865:80 \
-v /opt/data/bookstack/config:/config \
--restart unless-stopped \
--network=data_default \
linuxserver/bookstack</code></pre>



<p>Make sure to properly configure the environment variables such as &#8211; database user and password, URL, port, etc.</p>



<p>To check the container status, run &#8220;docker ps&#8221; and it should show the below result. Book stack is listening at port 5865.</p>



<pre class="wp-block-code"><code class="">ubuntu@webserver:/opt/data/bookstack$ docker ps
CONTAINER ID   IMAGE                   COMMAND   CREATED          STATUS          PORTS                                            NAMES
33effffbf170   linuxserver/bookstack   "/init"   3 minutes ago    Up 2 minutes    443/tcp, 0.0.0.0:5865-&gt;80/tcp, :::5865-&gt;80/tcp   bookstack
b7540622f83b   linuxserver/mariadb     "/init"   25 minutes ago   Up 25 minutes   3306/tcp                                         bookstackdb
</code></pre>



<p>Make necessary DNS entry to point the domain wiki.domain.com to the virtual machine IP and all set. BookStack is ready for use.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Final Steps</h2>



<p>Open any web browser and type in the URL http://wiki.yourdomain.com:5865 to access your wiki site.</p>



<p>This should take us to the BookStack login </p>



<figure class="wp-block-image size-full"><img decoding="async" width="885" height="613" src="//i1.wp.com/tekcookie.com/wp-content/uploads/2021/11/image-1.png" alt="" class="wp-image-4869" srcset="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/11/image-1.png?w=885&amp;ssl=1 885w, https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/11/image-1.png?resize=300%2C208&amp;ssl=1 300w, https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/11/image-1.png?resize=768%2C532&amp;ssl=1 768w" sizes="(max-width: 885px) 100vw, 885px" /></figure>



<p>The default admin login of BookStack is <strong>admin@admin.com</strong> with the password <strong>password</strong></p>



<p>Ensure to change the login email and the password after you login. Refer to the BookStack documentation <a href="https://www.bookstackapp.com/docs/admin/security/" target="_blank" rel="noreferrer noopener"><span style="text-decoration: underline;">https://www.bookstackapp.com/docs/admin/security/</span></a> for further configuration</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p></p><cite>Hope you liked this article and thank you for reading</cite></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/self-host-bookstack-using-docker/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4862</post-id>	</item>
	</channel>
</rss>
