1 year ago (1,001,970 XP)

@Mythos33 What does it say for the composer install command process or does it not show?

1 year ago (15,950 XP)

@Mythos33 I have got the same error. Maybe you have resolved this problem?


This is because the ./vendor folder created during the before_script phase isn't carried through into the testing builds. I've yet to reach a satisfactory answer for this - but its currently looking like you need to do a composer install for each of the different build instances.


It's actually something else... the [[ ! -e /.dockerenv ]] && [[ ! -e /.dockerinit ]] && exit 0 line is causing the script to drop out early


Issue is that /.dockerinit was removed in v1.11 so it always fails the test

Replacing that line with

[[ ! -e /.dockerenv ]] && exit 0

works just fine. Running php composer.phar install --no-plugins --no-scripts --dev then runs properly in the before_script section for every test build.


I'm sorry, but I totally forgot about this thread due to missing email notifications. ;-)

@gwawr 's solution works for me, thanks!


I have just tried @Refringe setup and Gitlab build fails with similar error as @Mythos33. I have copied files from into my project and push it into GitLab and build fails with error:

Running with gitlab-ci-multi-runner 1.9.0 (82714ae)
Using Docker executor with image php:5.6 ...
Pulling docker image mysql:5.6 ...
Starting service mysql:5.6 ...
Waiting for services to be up and running...
Pulling docker image php:5.6 ...
Running on runner-e11ae361-project-2277718-concurrent-0 via runner-e11ae361-machine-1483904340-0654037a-digital-ocean-4gb...
Cloning repository...
Cloning into '/builds/gandra404/ticketbeast'...
Checking out bacd084d as master...
$ bash
$ php vendor/bin/phpunit --colors
Could not open input file: vendor/bin/phpunit
ERROR: Build failed: exit code 1

Here is repo url of the failing project:

and here are failiong builds:

In case I made some new changes this is relevant commit:

@Mythos33, can you post your solution? I didn't get what have to change in order to work.


Finally I manage to run sucesfully tests on GitLab. Here is the project:

This article helped me a lot:

I have code on GitLab. Runner installed on my host(probably would work only with shared runner?) with docker as executor.

I have copied this files in my root:

The only error I had at first try was "Unable to prepare route [api/user] for serialization. Uses Closure."( but seems that is known error:

So, at the moment I have commented line php artisan route:cache andbuild paased ok!


These scripts are wonderful, thank you all for sharing your knowledge.

I have everything up and running but being new to the CI and docker/container worlds, I feel compelled to ask if theres any way to expedite the build process by pre-compiling php and extensions and creating a container--something along those lines.

Or is there a benefit to using the official images I'm missing out on?

If it helps, I used forge to provision my production server, so if there's a forge-flavored container I'd be safe running my ci-against that would be swell.

1 year ago (1,001,970 XP)

@scuttlebyte This may help: If you look at the Dockerfile, it's pre-compiled like you wanted.

1 year ago (6,655 XP)

Hi all,

While i was reading this topic

i was thinking if it's possibile to have this kind of test functionality into the docker container:

 public function testBasicExample()
             ->see('Laravel 5')

If not what i would need ? maybe a webserver that runs into the docker container ?

thank you


@Mythos33 had same issue but it was random, endedup deviding the stages into build (composer) and then tests and that seem to work for me.



I am following the same, however ended up with the permision denied error

$ ./vendor/bin/phpunit /bin/sh: eval: line 64: ./vendor/bin/phpunit: Permission denied ERROR: Job failed: exit code 2

I am using the image, image: zaherg/php-7.1-xdebug-alpine:latest

Also i am unable to run the command as sudo as well.

Can someone help on this.. thanks



vendor/bin/phpunit to 


php ./vendor/phpunit/phpunit/phpunit


Cool. Thanks for all this great work. I am stuck in the database connection establishment.

What credentials should I actually put in? I mean, at that point, it doesn't even know my live servers IP, I don't feel comfortable putting the live credentials there and it will probably not have access anyway.

This is the error message:

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover

   Illuminate\Database\QueryException  : SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = forge and table_name = settings)

  at /builds/securitas-fra/qs-tool/vendor/laravel/framework/src/Illuminate/Database/Connection.php: 664
  660:         // If an exception occurs when attempting to run a query, we'll format the error
  661:         // message to include the bindings with SQL, which will make this exception a
  662:         // lot more helpful to the developer instead of just the database's errors.
  663:         catch (Exception $e) {
  664:             throw new QueryException(
  665:                 $query, $this->prepareBindings($bindings), $e
  666:             );
  667:         }
  669:         return $result;

  Exception trace:

  1   Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(App\Providers\SettingsServiceProvider))
      [internal] : 0

  2   PDOException::("SQLSTATE[HY000] [2002] Connection refused")
      /builds/securitas-fra/qs-tool/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php : 68

  Please use the argument -v to see more details.

I am new to this whole topic with CI / CD and docker so forgive me :)

Please sign in or create an account to participate in this conversation.