|
@@ -0,0 +1,89 @@
|
|
|
+ <!DOCTYPE html>
|
|
|
+ <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
|
|
+ <head>
|
|
|
+ <title>Running Drupal in Docker</title>
|
|
|
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="keywords" content="Browser Based,Docker Made Easy,Home Lab,Home Lab Ideas,Install Guide,Self-Hosted,Web Based,Web Based Tools,Docker Container,Docker Host,Docker How To,Docker,Containerize,Containers,Docker Made Simple,Docker Setup Tutorial,Docker Simplified,FOSS,Drupal Installation Guide,WordPress,Ubuntu,How To Install Drupal In Docker,MariaDB,Linux,How To,Tutorial,i12bretro">
|
|
|
+ <meta name="author" content="i12bretro">
|
|
|
+ <meta name="description" content="Running Drupal in Docker">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <meta name="revised" content="08/15/2022 08:44:56 AM" />
|
|
|
+ <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
|
|
|
+ <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
|
|
+ <script type="text/javascript" src="includes/js/steps.js"></script>
|
|
|
+ <link href="css/steps.css" rel="stylesheet" type="text/css" />
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <div id="gridContainer">
|
|
|
+ <div class="topMargin"></div>
|
|
|
+ <div id="listName" class="topMargin">
|
|
|
+ <h1>Running Drupal in Docker</h1>
|
|
|
+ </div>
|
|
|
+ <div></div>
|
|
|
+ <div id="content">
|
|
|
+ <h2>What is Drupal?</h2>
|
|
|
+
|
|
|
+<blockquote><em>Drupal is content management software. It's used to make many of the websites and applications you use every day. Drupal has great standard features, like easy content authoring, reliable performance, and excellent security. -<a href="https://www.drupal.org/about" target="_blank">https://www.drupal.org/about</a></em></blockquote>
|
|
|
+
|
|
|
+<h2>Installing Docker</h2>
|
|
|
+
|
|
|
+<ol>
|
|
|
+ <li>Log into the Linux based device</li>
|
|
|
+ <li>Run the following commands in the terminal
|
|
|
+ <div class="codeBlock"># install prerequisites<br />
|
|
|
+ sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y<br />
|
|
|
+ # add docker gpg key<br />
|
|
|
+ curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -<br />
|
|
|
+ # add docker software repository<br />
|
|
|
+ sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"<br />
|
|
|
+ # install docker<br />
|
|
|
+ sudo apt install docker-ce docker-compose containerd.io -y<br />
|
|
|
+ # enable and start docker service<br />
|
|
|
+ sudo systemctl enable docker && sudo systemctl start docker<br />
|
|
|
+ # add the current user to the docker group<br />
|
|
|
+ sudo usermod -aG docker $USER<br />
|
|
|
+ # reauthenticate for the new group membership to take effect<br />
|
|
|
+ su - $USER</div>
|
|
|
+ </li>
|
|
|
+</ol>
|
|
|
+
|
|
|
+<h2>Running the Drupal Container</h2>
|
|
|
+
|
|
|
+<ol>
|
|
|
+ <li>Now that Docker is installed, run the following commands to setup the Drupal Docker container and run it
|
|
|
+ <div class="codeBlock"># create working directories<br />
|
|
|
+ mkdir ~/docker/drupal -p && mkdir ~/docker/mariadb -p<br />
|
|
|
+ # set ownership on the working directories<br />
|
|
|
+ sudo chown "$USER":"$USER" ~/docker -R<br />
|
|
|
+ # create containers network<br />
|
|
|
+ docker network create containers<br />
|
|
|
+ # run the mariadb docker container<br />
|
|
|
+ docker run -d --name mariadb -e MYSQL_ROOT_PASSWORD=r00tp@$$ -e MYSQL_USER=drupal_rw -e MYSQL_PASSWORD='Dru4@l!!' -e MYSQL_DATABASE=drupal -v ~/docker/mariadb:/var/lib/mysql --network containers --restart unless-stopped mariadb<br />
|
|
|
+ # initialize the drupal application files<br />
|
|
|
+ docker run --rm drupal tar -cC /var/www/html . | tar -xC ~/docker/drupal<br />
|
|
|
+ # make a copy of default.settings.php<br />
|
|
|
+ cp ~/docker/drupal/sites/default/default.settings.php ~/docker/drupal/sites/default/settings.php<br />
|
|
|
+ # create the files directory<br />
|
|
|
+ mkdir ~/docker/drupal/sites/default/files<br />
|
|
|
+ # allow the container to write to files/ and settings.php<br />
|
|
|
+ sudo chmod a+rwx -R ~/docker/drupal/sites/default/files<br />
|
|
|
+ sudo chmod a+rwx -R ~/docker/drupal/sites/default/settings.php<br />
|
|
|
+ # run the drupal docker container<br />
|
|
|
+ docker run -d --name=drupal -p 8880:80 -v ~/docker/drupal/modules:/var/www/html/modules -v ~/docker/drupal/profiles:/var/www/html/profiles -v ~/docker/drupal/sites:/var/www/html/sites -v ~/docker/drupal/themes:/var/www/html/themes --network containers --restart unless-stopped drupal</div>
|
|
|
+ </li>
|
|
|
+ <li>Open a web browser and navigate to http://DNSorIP:8880</li>
|
|
|
+ <li>The Drupal setup screen should be displayed</li>
|
|
|
+ <li>Select a language > Click Save and continue</li>
|
|
|
+ <li>Select the Standard profile > Click Save and continue</li>
|
|
|
+ <li>Enter the database name, username and password > Expand Advanced and set the Host value to mariadb (the mariadb container name) > Click Save and continue</li>
|
|
|
+ <li>Create a site title and Drupal login > Click Install Drupal</li>
|
|
|
+ <li>When the installation completes, enter a site name, email address, username and password > Click Save and continue</li>
|
|
|
+ <li>Welcome to Drupal</li>
|
|
|
+</ol>
|
|
|
+
|
|
|
+<p>Documentation: <a href="https://hub.docker.com/_/drupal" target="_blank">https://hub.docker.com/_/drupal</a></p> </div>
|
|
|
+ </div>
|
|
|
+ </body>
|
|
|
+ </html>
|
|
|
+
|