EugenMayer/docker-sync

Error getting mapped port, exit code 0

riwcardosaiz opened this issue · 1 comments

Hello,

I'm trying to configure a docker-sync with unison, and I receive an error.

First, my setup:

  • Docker for mac (20.10.0) running on macOS Big Sur (11.1)
  • docker-sync (0.5.14)
  • unison version 2.51.3 (ocaml 4.10.0)

docker-sync.yml

  version: '2'
  syncs:
    elrow-sync:
      src: '.'
      sync_strategy: 'unison'
      sync_userid: from_host
      sync_host_ip: 'auto'
      max_attempt: 5
      notify_terminal: true
      sync_excludes: ['.*/.git', '.*/node_modules', '.*/bower_components', '.*/.sass-cache', '.scss', '.sass', '.gitignore', '.js']
      monit_enabled: true
      sync_userid: '1000'
      sync_args: '-v'

The service on docker-compose:

  unison:
    image: onnimonni/unison
    environment:
      - UNISON_DIR=/var/www/elrow
      - UNISON_UID=10000
      - UNISON_GID=10000
    ports:
      - "5000:5000"
    volumes:
      - /var/www/elrow

Second, the error

command  docker inspect --format='{{(index (index .NetworkSettings.Ports "5000/tcp") 0).HostPort}}' elrow-sync
error  Error getting mapped port, exit code 0
message  Template parsing error: template: :1:3: executing "" at <index (index .NetworkSettings.Ports "5000/tcp") 0>: error calling index: index of untyped nil

Traceback (most recent call last):
  15: from /usr/local/bin/docker-sync:23:in `<main>'
  14: from /usr/local/bin/docker-sync:23:in `load'
  13: from /Library/Ruby/Gems/2.6.0/gems/docker-sync-0.5.14/bin/docker-sync:14:in `<top (required)>'
  12: from /Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
  11: from /Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
  10: from /Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
  9: from /Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
  8: from /Library/Ruby/Gems/2.6.0/gems/docker-sync-0.5.14/tasks/sync/sync.thor:47:in `start'
  7: from /Library/Ruby/Gems/2.6.0/gems/docker-sync-0.5.14/tasks/sync/sync.thor:170:in `daemonize'
  6: from /Library/Ruby/Gems/2.6.0/gems/docker-sync-0.5.14/lib/docker-sync/sync_manager.rb:102:in `start_container'
  5: from /Library/Ruby/Gems/2.6.0/gems/docker-sync-0.5.14/lib/docker-sync/sync_manager.rb:102:in `each'
  4: from /Library/Ruby/Gems/2.6.0/gems/docker-sync-0.5.14/lib/docker-sync/sync_manager.rb:103:in `block in start_container'
  3: from /Library/Ruby/Gems/2.6.0/gems/docker-sync-0.5.14/lib/docker-sync/sync_process.rb:105:in `start_container'
  2: from /Library/Ruby/Gems/2.6.0/gems/docker-sync-0.5.14/lib/docker-sync/sync_strategy/unison.rb:211:in `start_container'
  1: from /Library/Ruby/Gems/2.6.0/gems/docker-sync-0.5.14/lib/docker-sync/sync_strategy/unison.rb:211:in `loop'
/Library/Ruby/Gems/2.6.0/gems/docker-sync-0.5.14/lib/docker-sync/sync_strategy/unison.rb:216:in `block in start_container': Failed to start unison container in time, try to increase max_attempt (currently 5) in your configuration. See https://github.com/EugenMayer/docker-sync/wiki/2.-Configuration for more informations (RuntimeError)

I tried to change the max_attempt to 30 but the error still happen, so I think is not the main problem.

Thanks! :)

Please test your setup with the boilerplate https://github.com/EugenMayer/docker-sync-boilerplate/tree/master/unison

If that is working, understand the configuration differences otherwise please post the error the boilerplate throws. Thanks