Docker Cheat sheet

Quick commands :

— to rebuild after changes to the Dockerfile.
docker-compose build

— équivalent de vagrant up
docker-compose up -d

— accéder au container. container_php is the container name.
docker exec -it container_php bash

To install :


Symfony PHP Testing with PHPUnit (Reminders)

Start the web server
php bin/console server:start -d public

Run test on file
./vendor/bin/simple-phpunit tests/Controller/Api/filenametotest.php


Console app hangs until a key is pressed

On Windows,

When you run a console application, it happens that it freezes and it unfreezes just by hitting a key.

That behavior just made me lose about an hour of computing time this morning. Like it is often, the answer seem to be on StackOverflow

I’m trying this.


PHPExcel – PHP 7

Don’t forget to install php zip library if phpexcel outputs a 0 byte file.

sudo apt-get install php7.0-zip


MySQL – Remove definers

Remove definers from mysql dump files.

sed -r -e ‘s/DEFINER=’.+’@’.+’\s//’ < dump.sql  > dump-final.sql

I will update this entry when I can find the blog I found it on just so the person can get credit for it.

Other options is to rename the definers.

UPDATE `mysql`.`proc` p SET definer = ‘newdefiner’ WHERE definer=’olddefiner’ AND db LIKE ‘databasename’;


Ubuntu – Start shell script from desktop shortcut

cd /usr/share/applications
sudo nano myapp.desktop

[Desktop Entry]
Exec=sh -c ‘/home/USER/scripts/myscript’ && disown

Replace USER by your username
For Icon, type the whole path to your image.

Drag and drop your newly created shortcut to Ubuntu left menu bar.


Vagrant issues with mounting shares. Ubuntu 16.04

If you have the following when you do vagrant up :

Failed to mount folders in Linux guest. This is usually because
the “vboxsf” file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u www-data`,gid=`getent group www-data | cut -d: -f3`,dmode=775,fmode=774 vflsf_s8ktdqeoxrjd /var/www
mount -t vboxsf -o uid=`id -u www-data`,gid=`id -g www-data`,dmode=775,fmode=774 vflsf_s8ktdqeoxrjd /var/www

The error output from the last command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device

You probably have a different version of the guest additions installed in your virtual machine. if it is the case do the following.

sudo vagrant plugin install vagrant-vbguest

if that fails with :

Installing the ‘vagrant-vbguest’ plugin. This can take a few minutes…
/usr/lib/ruby/2.3.0/rubygems/specification.rb:946:in `all=’: undefined method `group_by’ for nil:NilClass (NoMethodError)
from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:275:in `with_isolated_gem’
from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:231:in `internal_install’
from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:102:in `install’
from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:62:in `block in install_plugin’
from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:72:in `install_plugin’
from /usr/share/vagrant/plugins/commands/plugin/action/install_gem.rb:37:in `call’
from /usr/lib/ruby/vendor_ruby/vagrant/action/warden.rb:34:in `call’
from /usr/lib/ruby/vendor_ruby/vagrant/action/builder.rb:116:in `call’
from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:66:in `block in run’
from /usr/lib/ruby/vendor_ruby/vagrant/util/busy.rb:19:in `busy’
from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:66:in `run’
from /usr/share/vagrant/plugins/commands/plugin/command/base.rb:14:in `action’
from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:32:in `block in execute’
from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:31:in `each’
from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:31:in `execute’
from /usr/share/vagrant/plugins/commands/plugin/command/root.rb:56:in `execute’
from /usr/lib/ruby/vendor_ruby/vagrant/cli.rb:42:in `execute’
from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:268:in `cli’
from /usr/bin/vagrant:173:in `<main>’

Remove vagrant

sudo apt-get remove vagrant

Install it with the debian package coming directly from the vagrant website.

Then run

sudo vagrant plugin install vagrant-vbguest