Best methods to work with Docker


I want to ask you what’s the best method to work Docker.
Currently we use Bitbucket for versionning, Capistrano to deploy in the Docker container or to the server where Docker is hosted, and nginx-proxy from jwilder to access differents website from everywhere. There are the differents questions :

Keep in mind, Docker config files and source code will be updated almost everyday.

Bitbucket :

  • Having two repos for one project (on BitBucket), one for the Docker files (docker-compose, apache configuration…) and one for the source code of the website.
  • Or use one repo (on BitBucket), with a folder named docker at the root that contain the Docker files (docker-compose, apache configuration…), and one other named wwwroot that contain source code.

Deploy with Capistrano :

  • Run a SSH server inside the apache container of the project, capistrano connect to the apache container (using a key), and do a deploy in it (of course Capistrano manage by himself the release, current, shared folder)
  • Or Capistrano deploy on the server where Docker is hosted not in the container that contain the source code.

Executing npm, composer, grunt during a deploy with Capistrano :
On each deploy we need to execute of course npm install, composer install…

  • Create .rake that contain all command need to be executed on each deploy.
  • Or say to Capistrano to execute a .sh script in the release folder on the server that host Docker on each deploy ?

Managing environnment :

What’s the best way to manage the differents environnments ?
For example, we clone the entire project we wan’t to set to DEV the env. So all Docker containers will be launched with local DEV config. Same for pre production, production staging…

Thank you for you answer, maybe you cannot give an advice to all, but some should be very very nice !