At a minimum you will need to run
docker run --name joe-beaver -d osuwams/drupal
You can either set these in your shell or use the -e or --env flags at run time.
docker run -d \
-e DRUPAL_DBUSER=myuser \
-e DRUPAL_DBPASS=mypass \
-e DRUPAL_DBNAME=mydb \
--name joe-beaver osuwams/drupal
If you are going to run a MySQL compatible database on a different host/port then run with
docker run -d \
-e DRUPAL_DBUSER=myuser \
-e DRUPAL_DBPASS=mypass \
-e DRUPAL_DBNAME=mydb \
-e DRUPAL_DBPORT=3306 \
-e DRUPAL_DBHOST=localhost \
--name joe-beaver osuwams/drupal
If you wish to use OSU Profiles and Connect for Profile Data you'll need LDAP Credentails and to update your Run with
docker run -d \
-e DRUPAL_DBUSER=myuser \
-e DRUPAL_DBPASS=mypass \
-e DRUPAL_DBNAME=mydb \
-e DRUPAL_DBPORT=3306 \
-e DRUPAL_DBHOST=localhost \
-e LDAP_BIND_DN=some_bind_dn \
-e LDAP_PIND_PW=your_bind_password \
--name joe-beaver osuwams/drupal
There are three environment variables are required if you want to have the container auto configure the Drupal database configuration.
DRUPAL_DBUSERThis variable tells Drupal what the user is to connect to the database.
DRUPAL_DBPASSThis variable tells Drupal what password to use to connect to the database.
DRUPAL_DBNAMEThis variable tells Drupal what database to use.
DRUPAL_DBPORTThis is an optional variable and if left off will default to 3306.
DRUPAL_DBHOSTThis is optional variable and if left off will default to localhost
DRUPAL_MEMCACHESet this to true to enable Memcache support.
DRUPAL_MEMCACHEHOSTSet this only if your Memcache host is not localhost/127.0.0.1
DRUPAL_DOMAIN_HOSTIf you are using a multisite database and files this will create a symbolic link in the sites directory to make files work.
LDAP_BIND_DN & LDAP_BIND_PWThis is required to use Profiles syncing
There are different reasons to use volume mounts in docker. If you need some parts of the Drupal site to persist a docker image upgrade specify them. There are a few examples below in the yaml config.
Docker allow provides a bind mount option to bring local folders from the host matching into the running container.
Drupal Private files are configured to be under /var/www/private_files
version: "3.7"
services:
database:
image: mariadb:10.1
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
# To bring in your own database uncomment the following and either make the mariadb-init folder or update the system mount
# volumes:
# - ./mariadb-init:/docker-entrypoint-initdb.d
drupal:
image: osuwams/drupal:7-apache
ports:
- 8080:80
volumes:
- /var/www/html/sites/all/modules
- /var/www/html/sites/all/themes
- /var/www/html/sites/default
# Below are other volumes that can be used.
# - ./files:/var/www/html/sites/default/files
# - ./local-theme:/var/www/html/sites/default/themes
# - ./local-modules:/var/www/html/sites/default/modules
environment:
DRUPAL_DBHOST: database
DRUPAL_DBUSER: drupal
DRUPAL_DBNAME: drupal
DRUPAL_DBPASS: drupal
DRUPAL_DBPORT: 3306
LDAP_BIND_DN: your_bind_dn
LDAP_BIND_PW: your_bind_password
DRUPAL_MEMCACHE:true
DRUPAL_MEMCACHEHOST:cache
depends_on:
- database
cache:
image: memcached:1
Copy the code above to either a docker-compose.yml or a stack.yml file (or really any *.yml file of your choosing). Docker Compose will look for a docker-compose.yml in the directory you are currently in.
Run docker-compose up -f <yourname>.yml -d or docker stack deploy -c stack.yml wait for the stack to finish deploying and you can access your site at http://localhost:8080, or http://host-ip:8080
Content type
Image
Digest
sha256:d3b9f449b…
Size
246.1 MB
Last updated
7 months ago
docker pull osuwams/drupal