Calystod / docker-drupal-example

This is a project example to bootstrap a Drupal 8 project with Docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-drupal-example

This is a project example to launch Drupal 8 with Docker

First information

This project has for goal to present simply how to create a docker environment to people which have never work with Docker. This project is concentrate on Drupal specifically but can be adapt to work with other technologies.

You find documentation links and commentaries. If you want complete or correct errors, you can fork this project and do a pull request.

To know how to assign a static IP to containers, you can checkout the branch docker-networks. But this branch is in work in progress and this methology isn't recommand except if we want access to container on external networks.

Prerequires

Before to launch the project for the first time, you need install some composants on your environment.

On Debian or Ubuntu

  • Docker CE

For Linux:

For Mac OS:

For Windows:

Important: Docker on Linux doesn't work exactly in the same way than on Mac OS and Windows. On these two last environments, Docker works with the Docker Toolbox. It's an application which contain all elements necessary for Docker together with the Docker Machine and some experimental features enabled by default.

This project is realized on Linux, so the documentation could be uncompleted or wrong for Mac OS and Windows.

First launch

To up your containers, launch:

docker-compose up

If it's your first launch, this command will build your containers too.

Let the up run and go in an other tab on your terminal.

To launch command on your environment, you will used the php-cli container. To go in, launch:

docker-compose run --rm php-cli bash

If you want, you could add this command in a alias.

When you enter in the php-cli container, you should be to in /var/www/html

Launch the command: composer install

Many things will be install:

  • Drupal core
  • Drush

You can go on your browser and go to http://127.0.0.1/

Warning: This is true on Linux, not on Windows Home where you must connect to the IP of the VirtualBox machine which run. It is to see on Mac OS and Windows Pro.

Install your new website.

The database informations are:

  • Database name = docker_test (-> If you boostrap a new project based on this project, you should to change the value of the environment variable in the .env file)
  • Database user=drupal
  • Database password=drupal
  • Host=db (it's the name of the container which run MariaDB)

You can go on phpMyAdmin with http://127.0.0.1:8080/

Other informations:

In the file .env, the USER_UID must match with the USER_UID of your personnal user to have the same right.

Verify your user id with the command: id -u

and change the data in the .env if necessary. You can used an utility like direnv or a global variable.

and enjoy !

Documentation

About

This is a project example to bootstrap a Drupal 8 project with Docker


Languages

Language:PHP 100.0%