Goal: This time imagine you're just wanting to learn Drupal's admin and GUI, or maybe you're a software tester and you need to test a new theme for Drupal. When configured properly, this will let you build a custom image and start everything with docker-compose up including storing important db and config data in volumes so the site will remember your changes across Compose restarts.
FROM drupal:8.6 NOTE: if it fails to build, try the lastest 8 branch version with FROM drupal:8apt-get update && apt-get install -y gitrm -rf /var/lib/apt/lists/* and use \ and && properly. You can find examples of them in drupal official image. More on this below under Compose file.WORKDIR /var/www/html/themesRUN git clone --branch 8.x-3.x --single-branch --depth 1 https://git.drupal.org/project/bootstrap.gitchown to change file owners to the proper user: chown -R www-data:www-data bootstrap. Remember the first line needs a \ at end to signify the next line is included in the command, and at start of next line you should have && to signify "if first command succeeds then also run this command"/var/www/htmlcustom-drupal as we want to make a new image based on the official drupal:8.6.build: . to the drupal service. When we add a build + image value to a compose service, it knows to use the image name to write to in our image cache, rather then pull from Docker Hub.postgres:9.6 service, you need the same password as in previous assignment, but also add a volume for drupal-data:/var/lib/postgresql/data so the database will persist across Compose restarts.Appearance in top bar, and notice a new theme called Bootstrap is there. That's the one we added with our custom Dockerfile.Install and set as default. Then click Back to site (in top left) and the website interface should look different. You've successfully installed and activated a new theme in your own custom image without installing anything on your host other then Docker!docker-compose down it will delete containers, but not the volumes, so on next docker-compose up everything will be as it was.-v to down command.Content type
Image
Digest
Size
160.5 MB
Last updated
over 6 years ago
docker pull armijomariano/drupal