https://github.com/theodorosploumis/drupal-docker
Examples and best practices of using docker and docker-compose with Drupal 8.x
https://github.com/theodorosploumis/drupal-docker
docker docker-compose drupal drupal8
Last synced: 3 months ago
JSON representation
Examples and best practices of using docker and docker-compose with Drupal 8.x
- Host: GitHub
- URL: https://github.com/theodorosploumis/drupal-docker
- Owner: theodorosploumis
- Created: 2016-05-28T18:55:05.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-26T00:34:24.000Z (about 9 years ago)
- Last Synced: 2025-01-31T15:11:24.412Z (11 months ago)
- Topics: docker, docker-compose, drupal, drupal8
- Language: PHP
- Homepage:
- Size: 43 KB
- Stars: 7
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Using Drupal 8.x with Docker
### 1. Clone this repo
```
git clone git@github.com:theodorosploumis/drupal-docker.git
cd drupal-docker
```
### 2. Start the containers with docker-compose
```
// If you want to build the images before running the containers run:
// docker-compose build
docker-compose up -d
```
Notice that containers **drupalconsole_volumed** and **drush_volumed**
will exit immetiately after starting as they are volumed
containers. These containers are used just to mount their executables (drush and console accordingly).
For the same reason they cannot be used separately but only as linked containers (they need php though).
### 3. Prepare Drupal site for installation
```
// You can run the prepare-install.sh script
docker exec drupal_8082 bash /scripts/prepare-install.sh
// Or manually
docker exec drupal_8082 sh -c "\
cp sites/default/default.settings.php sites/default/settings.php && \
chmod 777 sites/default/settings.php && \
mkdir sites/default/files && \
chown -R www-data:www-data sites/default && \
chmod -R 777 sites/default/files && \
chmod 644 sites/default/default.settings.php && \
chmod 644 sites/default/default.services.yml"
```
### 4.1 Install with Drush
```
// You can run the drush-install.sh script
docker exec drupal_8082 bash /scripts/drush-install.sh
// Or manually
set DRUPAL_PROFILE=standard
docker exec drupal_8082 drush \
site-install -y ${DRUPAL_PROFILE} \
--site-name="Drupal 8 with Docker - Drush" \
--db-url=mysql://drupal:drupal@mysql/drupal \
--site-mail=admin@example.com \
--account-name=admin \
--account-pass=admin \
--account-mail=admin@example.com
```
Or...
### 4.2 Install with Drupal console
```
// Init drupal console and fix requirements
docker exec drupal_8082 sh -c "\
drupal init && \
drupal settings:set checked 'true'"
// You can run the console-install.sh script
docker exec drupal_8082 bash /scripts/console-install.sh
// Or manually
set DRUPAL_PROFILE=standard
docker exec drupal_8082 drupal \
site:install -y ${DRUPAL_PROFILE} \
--langcode=en \
--db-type=mysql \
--db-prefix='' \
--db-port=3306 \
--db-host=mysql \
--db-name=drupal \
--db-user=drupal \
--db-pass=drupal \
--site-name="Drupal 8 with Docker - Console" \
--site-mail=admin@example.com \
--account-name=admin \
--account-pass=admin \
--account-mail=admin@example.com
```
## Similar projects
- [runeasgar/docker_drupal_stack](https://github.com/runeasgar/docker_drupal_stack)