Public | Automated Build

Last pushed: a year ago
Short Description
Behat image based on Alpine Linux with PHP7.
Full Description

Environment for running Behat tests.

This image is based on Alpine Linux with PHP7 and could be used to test Docker and non-Docker websites.

This image includes (composer update is possible):



Mink extension

Mink goutte driver

Mink selenium2 driver

Drupal extension


PHP Unit



Behat cucumber json formatter

Also, it uses official selenium/standalone-chrome image.


  • Clone a repository.
    git clone
  • Put your custom contexts into "features/bootstrap/" folder if needed.

  • Configure behat.yml for your custom contexts.

  • Put your tests into "features/" folder.

  • Configure volumes in docker-compose.behat.yml.

Non-docker websites

  • Set base URL in behat.yml for testing site.


base_url: ''
  • Run script to run tests.
  • To stop and remove containers use
    docker-compose -f docker-compose.behat.yml down 

Docker websites

  • Configure base URL in behat.yml for testing site in following way.
base_url: '{https/http}://{web server service name}:{internal port}'


base_url: 'http://nginx:80'
  • Additionally for Drupal 8 add the following line into your settings.php.


$settings['trusted_host_patterns'][] = '^nginx$';

It is needed to grant access to you site for GouteDriver/Selenium server through Nginx container.

Change Nginx to your web server service name if needed.

  • In order to up testing environment

    docker-compose -f docker-compose.yml -f docker-compose.behat.yml up -d

    For additional information read about extending services and Compose files.

  • In order to run tests, after environment up commands and all site building command on other containers run the following command .

    docker-compose -f docker-compose.yml -f docker-compose.behat.yml exec behat /srv/ "{behat options}"

    Notice that you must add at least one option to run tests.

Composer update

In order to update composer before running tests do the following

  • Set COMPOSER_UPDATE variable to 1
  • Mount composer.json on your host machine as /srv/composer.json.
- {some path}/composer.json:/srv/composer.json

Using API methods of the Drupal extension for Behat.

  • Mount folder with drupal on your host machine as /drupal.


- {some path}/drupal8:/drupal
  • If you don't want to use API methods of the Drupal extension for Behat you must comment or delete following lines in behat.yml
    api_driver: drupal
    root: /drupal
    drupal_root: /drupal


  • Reports and text files with information about screenshots are saved in artifacts/ folder.

  • Screenshots will be uploaded to

For more information read, docker-compose.behat.yml and Nearly each code and config line has comments.

Additional thanks to Serge Skripchuk for his help.

Docker Pull Command
Source Repository