EugenMayer / docker-sync

Run your application at full speed while syncing your code for development, finally empowering you to utilize docker for development under OSX/Windows/*Linux
GNU General Public License v3.0
3.54k stars 289 forks source link

Cannot start docker-sync with macOS Monterey - Apple M1 Chip #809

Closed niick7 closed 2 years ago

niick7 commented 2 years ago

Hi Team, I could use docker-sync clean and docker-sync start with my old macOS Big Sur 11.1 and Intel processor.

However it didn't work with my new Macbook with the latest macOS version: Monterey 12.5 and Apple M1 pro Chip.

Notes:

Any suggestion would be highly appreciated.

Please see the detail error below.

Error/Feature Requestion/Docs

% docker-sync start
    ok  Starting unison for sync test-sync
          ok  test-sync container not running
          ok  Starting precopy
     precopy  docker run --rm -v "test-sync:/app_sync" -e APP_VOLUME=/app_sync -e TZ=$(basename $(dirname `readlink /etc/localtime`))/$(basename `readlink /etc/localtime`) -e UNISON_SRC="-socket 5000" -e UNISON_DEST="/app_sync" -e MONIT_ENABLE="false" -e MONIT_INTERVAL="" -e MONIT_HIGH_CPU_CYCLES="" -e UNISON_ARGS="-ignore='Name tmp/**' -ignore='Name log/**'" -e UNISON_WATCH_ARGS="" -e HOSTSYNC_ENABLE="0" -e UNISONSOCKET_ENABLE="1"  --name test-sync eugenmayer/unison:2.51.3-4.12.0-AMD64 /usr/local/bin/precopy_appsync
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
doing initial sync with unison
Unison 2.51.3 (ocaml 4.12.0): Contacting server...
Looking for changes
Reconciling changes
Propagating updates
UNISON 2.51.3 (OCAML 4.12.0) started propagating changes at 18:37:57.87 on 27 Jul 2022
[BGN] Copying  from /app_sync to /host_sync
[END] Copying
UNISON 2.51.3 (OCAML 4.12.0) finished propagating changes at 18:37:57.88 on 27 Jul 2022
Saving synchronizer state
Synchronization complete at 18:37:57  (1 item transferred, 0 skipped, 0 failed)
real    0m 0.53s
user    0m 0.49s
sys 0m 0.03s
chown ing file to uid 0
initial sync done using unison
          ok  creating test-sync container
     command  docker run -p 'localhost::5000' -v test-sync:/app_sync -e APP_VOLUME=/app_sync -e TZ=$(basename $(dirname `readlink /etc/localtime`))/$(basename `readlink /etc/localtime`) -e UNISON_SRC="-socket 5000" -e UNISON_DEST="/app_sync" -e MONIT_ENABLE="false" -e MONIT_INTERVAL="" -e MONIT_HIGH_CPU_CYCLES="" -e UNISON_ARGS="-ignore='Name tmp/**' -ignore='Name log/**'" -e UNISON_WATCH_ARGS="" -e HOSTSYNC_ENABLE="0" -e UNISONSOCKET_ENABLE="1"  --name test-sync -d eugenmayer/unison:2.51.3-4.12.0-AMD64
docker: Invalid ip address: localhost.
See 'docker run --help'.
          ok  starting initial sync of test-sync
     command  docker inspect --format='{{(index (index .NetworkSettings.Ports "5000/tcp") 0).HostPort}}' test-sync
     command  docker inspect --format='{{(index (index .NetworkSettings.Ports "5000/tcp") 0).HostPort}}' test-sync
       error  Error getting mapped port, exit code 125
     message  Template parsing error: template: :1:32: executing "" at <.NetworkSettings.Ports>: map has no entry for key "NetworkSettings"
     command  unison -testserver "/Users/dinhnhanvo/upmc/api" "socket://localhost:"
Traceback (most recent call last):
    15: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/bin/docker-sync:23:in `<main>'
    14: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/bin/docker-sync:23:in `load'
    13: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/docker-sync-0.7.2/bin/docker-sync:14:in `<top (required)>'
    12: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
    11: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    10: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
     9: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
     8: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/docker-sync-0.7.2/tasks/sync/sync.thor:47:in `start'
     7: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/docker-sync-0.7.2/tasks/sync/sync.thor:181:in `daemonize'
     6: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/docker-sync-0.7.2/lib/docker-sync/sync_manager.rb:102:in `start_container'
     5: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/docker-sync-0.7.2/lib/docker-sync/sync_manager.rb:102:in `each'
     4: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/docker-sync-0.7.2/lib/docker-sync/sync_manager.rb:103:in `block in start_container'
     3: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/docker-sync-0.7.2/lib/docker-sync/sync_process.rb:105:in `start_container'
     2: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/docker-sync-0.7.2/lib/docker-sync/sync_strategy/unison.rb:219:in `start_container'
     1: from /Users/dinhnhanvo/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/docker-sync-0.7.2/lib/docker-sync/sync_strategy/unison.rb:219:in `loop'
/Users/dinhnhanvo/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/docker-sync-0.7.2/lib/docker-sync/sync_strategy/unison.rb:226: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)

Docker Driver

% docker version
Client:
 Cloud integration: v1.0.24
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:04:45 2022
 OS/Arch:           darwin/arm64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.10.1 (82475)
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:01:01 2022
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.6
  GitCommit:        10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc:
  Version:          1.1.2
  GitCommit:        v1.1.2-0-ga916309
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Sync strategy

% unison -version
unison version 2.51.3 (ocaml 4.12.0)

Your docker-sync.yml

version: "2"
options:
  verbose: true
syncs:
  #IMPORTANT: ensure this name is unique and does not match your other application container name
  test-sync: #tip: add -sync and you keep consistent names as a convention
    src: .
    sync_host_ip: "localhost"
    sync_host_port: 10872
    sync_excludes: ["tmp/**", "log/**"]

sync_strategy: "rsync"

OS

Monterey 12.5 and Apple M1 pro Chip.

Other information

% ruby -v
ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [arm64-darwin21]
% gem -v
3.1.6
% docker-sync -v
0.7.2
Carolis commented 2 years ago

Are you using docker-desktop by any chance? I changed the settings to use "Use the new Virtualization framework" at the Experimental Features and it worked, maybe it can help

niick7 commented 2 years ago

Thank you so much @Carolis . It worked from my end.

So, I will need to close this issue.