We use docker-sync as a library in our own docker-stack startup script. It starts the docker-compose stack using a Ruby gem EugenMayer/docker-compose all this wrapped into a thor task. So:

  • Start docker-sync
  • Start a docker-compose stack based on some arguments like –dev and load the specific docker-compose files for that using xeger/docker-compose

docker-sync-stack is actually an example already, just see here:

  1. You run the sync manager with run :
  2. But you do not call .join_threads after that like her
  3. Then you just continue doing what you want to script, in my case, i start a new blocking task - docker-compose. But you could do anything.

Simple scripting example

require 'docker-sync/sync_manager'
require 'docker-sync/dependencies'
require 'docker-sync/config/project_config'

# load the project config
config = nil)
# now start the sync
@sync_manager = => config_path) # do not call .join_threads now

#### your stuff here
### debootsrapping
rescue SystemExit, Interrupt
  say_status 'shutdown', 'Shutting down...', :blue

rescue Exception => e

  puts "EXCEPTION: #{e.inspect}"
  puts "MESSAGE: #{e.message}"