Drupal 9 Docker Aplication for Linux/Mac/Windows and Out-of-the-box Development Environment
50K+
Table of Contents
This repo contains a Docker recipe for making a container running Drupal9, using Linux, Apache, MySQL, Memcache and SSH. You can also use it on the Drupal Contribution Sprints for quickly starting working on your Drupal9 project. Note that, despite what other Docker solutions do, this will deliver you a fast, one-shot container with all necessary services, thus avoiding the need of container orchestration and the need of installing more software.
To just Trial Drupal 9 please Install Docker.
To use this repository as development environment, on Linux, MacOSX or Win10 make sure both bash+docker are installed.
Feel free to test and report any issues.
https://docs.docker.com/installation/
Open a terminal and run
docker run -i -t -p 80:80 ricardoamaro/drupal9
That's it!
Credentials (user/pass): admin/admin
If you want Code and Database persistence with Drupal9 code
on the local/web folder and MySQL on the local/data folder:
git clone https://github.com/ricardoamaro/drupal9-docker-app.git
cd drupal9-docker-app
./drupal9_local.sh
git clone https://github.com/ricardoamaro/drupal9-docker-app.git
cd drupal9-docker-app
drupal9_local.bat
drupal9_local.sh or drupal9_local.bat for local developmentFor a fresh install or re-install of your existing code
local/data/ folderlocal/web/ folder with your Drupal 9 docroot
eg. composer create-project drupal-composer/drupal-project:8.x-dev local --no-interactionsites/default/settings.php filedrupal9_local.sh to linux/mac users or drupal9_local.bat to windows usersTo stop and restart the installed existing site
drupal9_local.sh or drupal9_local.bat on the same directoryUsing docker exec {ID} {COMMAND}, to run your own commands.
~$ docker run --name mydrupal9 -i -t -p 80:80 ricardoamaro/drupal9
~$ docker exec mydrupal9 uptime
10:02:59 up 16:41, 0 users, load average: 1.17, 0.92, 0.76
~$ docker exec mydrupal9 drush status
PHP binary : /usr/bin/php7.3
PHP config : /etc/php/7.3/cli/php.ini
PHP OS : Linux
Drush script : /.composer/vendor/drush/drush/drush
Drush version : 10.2.2
Drush temp : /tmp
Drush configs : /.composer/vendor/drush/drush/drush.yml
https://github.com/ricardoamaro/drupal7-docker-app https://github.com/ricardoamaro/drupal6-docker-app
git clone https://github.com/ricardoamaro/drupal9-docker-app.git
cd drupal9-docker-app
sudo docker build -t <yourname>/drupal9 .
sudo docker build -t ricardo/drupal9 https://github.com/ricardoamaro/drupal9-docker-app.git
Note1: you cannot have port 80 already used or the container will not start.
In that case you can start by setting: -p 8080:80
Note2: To run the container in the background
sudo docker run -d -t -p 80:80 <yourname>/drupal9
How to go back to the last docker run?
docker ps -al
(get the container ID)
docker start -i -a (container ID)
This will create an ID that you can start/stop/commit changes:
# sudo docker ps
ID IMAGE COMMAND CREATED STATUS PORTS
538example20 <yourname>/drupal9:latest /bin/bash /start.sh 3 minutes ago Up 6 seconds 80->80
Start/Stop
sudo docker stop 538example20
sudo docker start 538example20
Commit the actual state to the image
sudo docker commit 538example20 <yourname>/drupal9
Starting again with the commited changes
sudo docker run -d -t -p 80:80 <yourname>/drupal9 /start.sh
Shipping the container image elsewhere
sudo docker push <yourname>/drupal9
You can find more images using the Docker Index.
While i am developing i use this to rm all old instances
sudo docker ps -a | awk '{print $1}' | grep -v CONTAINER | xargs -n1 -I {} sudo docker rm {}
Feel free to submit any bugs, requests, or fork and contribute to this code. :)
git checkout -b my-new-feature)git commit -am 'Added some feature')git push origin my-new-feature)Created and maintained by Ricardo Amaro http://blog.ricardoamaro.com
GPL v3
Content type
Image
Digest
Size
306 MB
Last updated
about 5 years ago
docker pull ricardoamaro/drupal9