Public Repository

Last pushed: 2 years ago
Short Description
A simple PHP5-cli image with MySQLi extension
Full Description

Docker image repo template

A simple image for running php5-cli with the mysqli extension installed/enabled. I use it for running a dockerized
doctrine instance.


Follow the instructions below to use this image for running Doctrine. I'm assuming you are using Composer to manage dependencies, which should install Doctrine into the '/vendor' directory of your project.

Create a cli-config.php at the root of your project. It should at least contain:

For loading Doctrine classes

$entitymanager = EntityManager::create($connection, $config);
Entity manager to be used. Create a connection array and Doctrine configuration before this line.

return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($entitymanager);
Create the CLI configuration

I also like to create a shell script at the root of my project to easily migrate:

#!/usr/bin/env bash docker run -it --rm --name="php_doctrine_devapimob3nl" -v /home/bas/projects/dkr-api/src:/data -w /data --link mysql_devapimob3nl:database bdalenoord/php5.6-cli-mysqli php /data/vendor/bin/doctrine "$@"

This script accepts arguments for the doctrine command. Run it with as parameter list to show what arguments are supported.

You can also issue the following command to run Doctrine:
docker run -it --rm --name=[NAME] -v [SOURCE-DIRECTORY]:/data -w /data --link [MYSQL-CONTAINER]:database bdalenoord/php5.6-cli-mysqli php /data/vendor/bin/doctrine [DOCTRINE-COMMAND]

Substitute the following values:

  • [NAME]: Name of the container
  • [SOURCE-DIRECTORY]: Root of your project. It should contain a vendor/bin directory with a doctrine executable script.
  • [MYSQL-CONTAINER]: Running database container, where doctrine will execute the migration
  • [DOCTRINE-COMMAND]: Command to be executed by Doctrine, for instance orm:schema-tool:create
Docker Pull Command

Comments (0)