Docker is an open source platform for system administrators and developers to build, ship and to run distributed applications, whether its on the cloud, data center VMs, or on the laptops. Docker helps to automate the deployment of Linux applications inside software containers.
Docker4Drupal (A native docker-based local environment for Drupal) is an open source initiative by Wodby to setup Drupal local environments.
Docker4Drupal is supported for both Drupal 7 and Drupal 8 versions.
This write up helps you to set up a local Drupal environment in seconds.
You have to install the Docker for Linux to start with.
For Linux platform, you have to additionally install Docker Compose. You can install the
docker-compose by the following command in your Ubuntu terminal.
$ pip install docker-compose
Docker4Drupal to your local machine by running the following command in your Ubuntu terminal or alternatively download the package.
$ git clone https://github.com/Wodby/docker4drupal.git
Using the Docker compose file (docker-compose.yml) we can set up local environment for Drupal using a native Docker app on Linux, Mac OS X and Windows as well.
Place the Docker compose file in your Drupal Webroot. Navigate to the Drupal webroot in terminal and run the compose file using the following command.
$ docker-compose up -d
You will be able to access the Drupal site at http://localhost:8000, phpMyAdmin at http://localhost:8001, Mailhog at http://localhost:8002, Apache solr at http://localhost:8003 and Memcache Admin at http://localhost:8006/index.php by default (If you have not customized the port numbers in compose file).
You can connect to any container in the Drupal bundle by executing the following command. Replace SERVICE with the name of the service (e.g. php, mariadb, nginx, etc).
$ docker-compose exec SERVICE sh
Hope this helps! Please feel free to get in touch with us if you need any further assistance.