This guide assumes that your localhost's ports 80 and 8080 are already taken by other apps running.
Therefore, ports 81 and 8082 are used instead.
- create a project directory and copy the compose.yaml, install.yaml and Dockerfile into it
mkdir testdrupal
cd testdrupal
<copy the compose.yaml, install.yaml and Dockerfile here>
- create image from Dockerfile
sudo docker build -t demo_commerce_kickstart_3 .
- start up the containers
sudo docker compose -f install.yaml up -d
- navigate to
localhost:81and run the installer. Check the MariaDb option. When asked about the database name, user and password, enterdrupaleverywhere. Also, underAdvanced, replace the defaultlocalhostwithmariadbdemo.
4.1. Later on during the installation process, make sure to check the box Install all features with sample content. to install the complete store demo, when presented.
- Back to the terminal, copy container folders of interest on local filesystem
sudo docker cp kickstartdemo:/opt/drupal/web/modules ./modules
sudo docker cp kickstartdemo:/opt/drupal/web/profiles ./profiles
sudo docker cp kickstartdemo:/opt/drupal/web/themes ./themes
sudo docker cp kickstartdemo:/opt/drupal/web/sites ./sites
sudo docker cp kickstartdemo:/opt/drupal/private ./private
sudo chown -R www-data:www-data modules profiles themes sites private
- Restart the combination with complete config
sudo docker compose stop
sudo docker compose up -d
- To run
drushorcomposercommands:
First, you need to get inside the Drupal container. Run sudo docker exec - ti kickstartdemo bash
Once inside the container, you can run drush and composer commands. You don't need to prefix anything with sudo anymore.
-
Every change you make in the files on the local filesystem is instantly propagated in the corresponding file(s) inside the container.
-
To start over again, simply run
sudo docker compose down. This will erase all your containers. Then, clean up your folder, leaving only the compose.yaml, install.yaml and Dockerfile files. Then, go to step 3. -
phpmyadminis available atlocalhost:8082. To log in, usedrupalfor both username and password.