Use Docker containers for building Debian packages

I was compiling and packaging EmulationStation (ES) for Debian inside a Docker container (because ES has many build dependencies) and I got this error message:

dpkg-deb: error: control directory has bad permissions 2755 (must be >=0755 and <=0775)

It happened because Docker creates directories with SGID (2000) by default. From the chmod manpage:

Executable files with this bit set will run with effective gid set to the gid of the file owner.

To solve it add this line in your Dockerfile