adaptation from https://github.com/jeroenooms/docker