docker-sync stop throwing error after update to 0.4.2
$ docker-sync stop
ok Stopping sync container php-oxfam-sync
/Users/tanc/.rvm/gems/ruby-2.4.0/gems/docker-sync-0.4.2/lib/docker-sync/watch_strategy/unison.rb:30:in `kill': no implicit conversion from nil to integer (TypeError)
from /Users/tanc/.rvm/gems/ruby-2.4.0/gems/docker-sync-0.4.2/lib/docker-sync/watch_strategy/unison.rb:30:in `stop'
from /Users/tanc/.rvm/gems/ruby-2.4.0/gems/docker-sync-0.4.2/lib/docker-sync/sync_process.rb:93:in `stop'
from /Users/tanc/.rvm/gems/ruby-2.4.0/gems/docker-sync-0.4.2/lib/docker-sync/sync_manager.rb:135:in `block in stop'
from /Users/tanc/.rvm/gems/ruby-2.4.0/gems/docker-sync-0.4.2/lib/docker-sync/sync_manager.rb:134:in `each'
from /Users/tanc/.rvm/gems/ruby-2.4.0/gems/docker-sync-0.4.2/lib/docker-sync/sync_manager.rb:134:in `stop'
from /Users/tanc/.rvm/gems/ruby-2.4.0/gems/docker-sync-0.4.2/tasks/sync/sync.thor:65:in `stop'
from /Users/tanc/.rvm/gems/ruby-2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
from /Users/tanc/.rvm/gems/ruby-2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/tanc/.rvm/gems/ruby-2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
from /Users/tanc/.rvm/gems/ruby-2.4.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
from /Users/tanc/.rvm/gems/ruby-2.4.0/gems/docker-sync-0.4.2/bin/docker-sync:14:in `<top (required)>'
from /Users/tanc/.rvm/gems/ruby-2.4.0/bin/docker-sync:22:in `load'
from /Users/tanc/.rvm/gems/ruby-2.4.0/bin/docker-sync:22:in `<main>'
from /Users/tanc/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/tanc/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
docker-machine/dinghy+parallels
unison
OSX 10.12.4
Thats some leftover container since and the pid is either broken or wrong.
Please clean the stack, rm all volumes/containers for docker sync and start/stop again - this should not happen
$ docker-sync clean
Error response from daemon: Unable to remove volume, volume still in use: remove php-oxfam-sync: volume is in use - [32356d1492481b7edb7518fef5517c18377add2ff82ee808ae3affb910992b72, 2d173e86fd8e9d0b0a4a4c58bb41253b5ebec7a42c0b8818f3a8535db7e16f67]
success Finished cleanup. Removed stopped, removed sync container and removed their volumes
$ docker rm 32356d1492481b7edb7518fef5517c18377add2ff82ee808ae3affb910992b72
32356d1492481b7edb7518fef5517c18377add2ff82ee808ae3affb910992b72
$ docker rm 2d173e86fd8e9d0b0a4a4c58bb41253b5ebec7a42c0b8818f3a8535db7e16f67
2d173e86fd8e9d0b0a4a4c58bb41253b5ebec7a42c0b8818f3a8535db7e16f67
$ docker-sync clean
success Finished cleanup. Removed stopped, removed sync container and removed their volumes
$ docker-sync stop
ok Stopping sync container php-oxfam-sync
/Users/tanc/.rvm/gems/ruby-2.4.0/gems/docker-sync-0.4.2/lib/docker-sync/watch_strategy/unison.rb:30:in `kill': no implicit conversion from nil to integer (TypeError)...
What else do I need do remove?
remove the volumes and the .docker-sync folder in the project ( old pid )
To inspect any unused volumes check the folowing information about the docker volume command.
https://docs.docker.com/engine/reference/commandline/volume_ls/#filtering
In short, use the following commands to clean up your docker volumes
Show volumes not associated with a container
docker volume ls -qf dangling=true
Remove volumes not associated with a container
docker volume rm $(docker volume ls -qf dangling=true)
Use at your own risk. Read the docker docs before executing the above commands.
filter is no longer needed
docker volume prune
docker container prune
docker image prune
its all there nowdays
Cool. Just wanted to add some info for people stumbling on this issue and not knowing how to delete these volumes.
Learn somehting new every day 👍
@ericmulder1980 reset your docker cli knowledge, .16 introduced a lot of cool ne stuff - check it out :)
@EugenMayer thanx.
Did some more testing and even after pruning all containers / volumes i still get the same errors posted by @tanc.
docker-sync stop
results in
ok Stopping sync container bejo-sync
/Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.3/lib/docker-sync/watch_strategy/unison.rb:30:in `kill': no implicit conversion from nil to integer (TypeError)
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.3/lib/docker-sync/watch_strategy/unison.rb:30:in `stop'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.3/lib/docker-sync/sync_process.rb:93:in `stop'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.3/lib/docker-sync/sync_manager.rb:135:in `block in stop'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.3/lib/docker-sync/sync_manager.rb:134:in `each'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.3/lib/docker-sync/sync_manager.rb:134:in `stop'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.3/tasks/sync/sync.thor:65:in `stop'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.3/bin/docker-sync:14:in `<top (required)>'
from /usr/local/bin/docker-sync:23:in `load'
from /usr/local/bin/docker-sync:23:in `<main>'
I cannot reproduct this, and e bet, if you use https://github.com/EugenMayer/docker-sync-boilerplate/tree/master/native_osx_with_user you wont be able to do so either
@EugenMayer in #370 you raise the question if the project should switch back to Unison as default strategy due to several issues with Native OSX strategy. Have these been addressed in the latest release?
No, not yet - thats why i am raising it. It would be only temporary, since native_osx is the better option - but we need to solve some quirks first.
The issue you have is something else so, nothing we would be addressing
@EugenMayer. I am having the same error of @ericmulder1980 and @tanc when i try to execute docker-sync stop:
ok Stopping sync container ssh-volume
/Users/gabrielgomes/.rvm/gems/ruby-2.2.1/gems/docker-sync-0.4.3/lib/docker-sync/watch_strategy/unison.rb:30:in `kill': no implicit conversion from nil to integer (TypeError)
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/gems/docker-sync-0.4.3/lib/docker-sync/watch_strategy/unison.rb:30:in `stop'
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/gems/docker-sync-0.4.3/lib/docker-sync/sync_process.rb:93:in `stop'
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/gems/docker-sync-0.4.3/lib/docker-sync/sync_manager.rb:135:in `block in stop'
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/gems/docker-sync-0.4.3/lib/docker-sync/sync_manager.rb:134:in `each'
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/gems/docker-sync-0.4.3/lib/docker-sync/sync_manager.rb:134:in `stop'
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/gems/docker-sync-0.4.3/tasks/sync/sync.thor:65:in `stop'
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/gems/docker-sync-0.4.3/bin/docker-sync:14:in `<top (required)>'
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/bin/docker-sync:23:in `load'
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/bin/docker-sync:23:in `<main>'
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
from /Users/gabrielgomes/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'
This also started to happen after update to version 0.4.2.
My docker-sync.yml:
version: "2"
syncs:
ssh-volume:
src: '~/.ssh'
sync_userid: 0
sync_strategy: 'unison'
mysql-data:
src: '~/docker-sync/mysql'
sync_userid: 0
sync_strategy: 'unison'
project:
src: '.'
sync_userid: 0
sync_strategy: 'unison'
An interesting point is that even getting error, the first unison container have been stopped, remaining the others:

I imagined that it could be something that occurs starting from the second volume, but i got the same error when i made i test with a single unison volume configured in docker-sync.yml.
@gbgdev you have this issue even with unison as strategy? in 0.4.x we neither changed anything on unison nor we worked on the daemon code. So either this issue is related to something which was there in 0.3.x or i cannot imagine where to start searching.
It could be a multi-sync issue..not sure - but you already made the test to prove me wrong.
@masterful could you imagine something?
I don't have a mac to test this with anymore - but my hunch is it's because of this addition:
https://github.com/EugenMayer/docker-sync/commit/7e324508c12103621af42774f8045479867c7ee8#diff-459fc0487c463d789f68791b54b187c3R65
Calling stop on the sync_manager presumes that the instance you're referencing has started up its own process. However, because calling docker-sync stop doesn't start the sync/watch processes it doesn't have a reference to a previous invocation's pids (it's why we store the parent process pid in a configurable file so we can kill it later). I'm guessing you didn't run into this because you're not using unison watch strategy in your current environment?
Does that help?
@masterful thank you! i kinda understand where you are heading too, i will try to dig into that. great!
Is this still reproducable with 0.4.6
@EugenMayer Yes, it still have error on 0.4.6 version
it is new project
sync strategy: unison
...
/Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/lib/docker-sync/watch_strategy/unison.rb:30:in `kill': no implicit conversion from nil to integer (TypeError)
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/lib/docker-sync/watch_strategy/unison.rb:30:in `stop'
...
@EugenMayer I also experience this bug. But it's not urgent, only slightly annoying. After stop, I can just run start and sync will work just fine. This warning might be because the way Unison sync_strategy return the watch fork result. I'm not too familiar with ruby forking, so cannot help much for this bug.
Additional information. When I do this, it works fine:
kill `cat .docker-sync/daemon.pid`
docker-sync start
Using kill is enough to get all unison, unison-fsmonitor, and daemon process killed. Here is the result of ps -A before kill and after.
Before kill:
$ ps A|grep daemon
...
72876 ?? S 0:00.11 daemon
72939 ?? S 0:00.00 daemon
72953 ?? S 0:00.00 daemon
...
$ ps A|grep unison
...
72941 ?? S 0:01.01 unison -ignore=Name .DS_Store -ignore=Name ._* /Users/donnykurnia/data/the_project/vendor/bundle -auto -batch -prefer /Users/donnykurnia/data/the_project/vendor/bundle -copyonconflict socket://192.168.101.100:32775 -repeat watch
72945 ?? S 0:02.99 /usr/local/Cellar/unox/0.2.0_1/libexec/bin/python /usr/local/bin/unison-fsmonitor
72954 ?? S 0:00.14 unison -ignore=Name vendor/bundle -ignore=Name vendor/cache -ignore=Name tmp/cache -ignore=Name public/assets -ignore=Name .git* -ignore=Name .DS_Store -ignore=Name ._* -ignore=Name .docker* -ignore=Name docker*yml -ignore=Name Dockerfile* -ignore=Name notes -ignore=Name data /Users/donnykurnia/data/the_project -auto -batch -prefer /Users/donnykurnia/data/the_project -
copyonconflict socket://192.168.101.100:32776 -repeat watch
72955 ?? S 1:09.56 /usr/local/Cellar/unox/0.2.0_1/libexec/bin/python /usr/local/bin/unison-fsmonitor
After kill, all the process above not shown again in the ps A result.
So, maybe for unison watch strategy, all its need is only kill, and thor script already doing it on https://github.com/EugenMayer/docker-sync/blob/master/tasks/sync/sync.thor#L69. I only tested this in VirtualBox docker machine.
I'm also getting this exception on v0.4.6 and after cleaning all the volumes
Using unison strategy with docker-machine.

@yborunov Yes, me too. Same version, same error.
@donnykurnia thanks for the kill tip, that seems to work nicely for me while docker-sync stop always throws an error. Note that the kill `cat .docker-sync/daemon.pid` command needs to be run where the docker-sync.yml lives.
Additional information:
Using native_osx strategy, docker-sync stop works perfectly and will not throw any errors. I think this is caused by the watch strategy execution.
@tanc of course, unless you know the absolute path for the daemon.pid file location, or find the correct PID from ps then use it for kill.
The solutions above haven't worked for me, as unison always restarts itself.
grasdaggel@MPBMS ~/Documents/Projekte/m2 master docker-sync stop
ok Stopping sync container m2-native
/Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/lib/docker-sync/watch_strategy/unison.rb:30:in `kill': no implicit conversion from nil to integer (TypeError)
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/lib/docker-sync/watch_strategy/unison.rb:30:in `stop'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/lib/docker-sync/sync_process.rb:93:in `stop'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/lib/docker-sync/sync_manager.rb:135:in `block in stop'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/lib/docker-sync/sync_manager.rb:134:in `each'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/lib/docker-sync/sync_manager.rb:134:in `stop'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/tasks/sync/sync.thor:65:in `stop'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/bin/docker-sync:14:in `<top (required)>'
from /usr/local/bin/docker-sync:23:in `load'
from /usr/local/bin/docker-sync:23:in `<main>'
Hi,
Have anybody solve this problem? Are there any possibilities how to fix it? Thanks.
I'm suffering the same problem with unison. When "docker-sync stop", the result is:
/Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/lib/docker-sync/watch_strategy/unison.rb:30:in kill': no implicit conversion from nil to integer (TypeError)
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/lib/docker-sync/watch_strategy/unison.rb:30:instop'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/lib/docker-sync/sync_process.rb:93:in stop'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/lib/docker-sync/sync_manager.rb:135:inblock in stop'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/lib/docker-sync/sync_manager.rb:134:in each'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/lib/docker-sync/sync_manager.rb:134:instop'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/tasks/sync/sync.thor:65:in stop'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor/command.rb:27:inrun'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in invoke_command'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor.rb:387:indispatch'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor/base.rb:466:in start'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.4.6/bin/docker-sync:14:inload'
from /usr/local/bin/docker-sync:23:in
Having this problem too. Happens with fresh install of everything on all my macbooks
The problem remains after upgrading docker-sync to v0.5.2
Same here on v0.5.2 and Ubuntu WSL on windows
Anyone know if this is being worked on?
nobody is working on this ATM
Error response from daemon: container ".....": already exists
Error: failed to start containers: ...-sources-sync
/Library/Ruby/Gems/2.0.0/gems/docker-sync-0.5.2/lib/docker-sync/sync_strategy/native_osx.rb:97:in `start_container': Start failed (RuntimeError)
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.5.2/lib/docker-sync/sync_process.rb:105:in `start_container'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.5.2/lib/docker-sync/sync_manager.rb:99:in `block in start_container'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.5.2/lib/docker-sync/sync_manager.rb:98:in `each'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.5.2/lib/docker-sync/sync_manager.rb:98:in `start_container'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.5.2/tasks/sync/sync.thor:163:in `daemonize'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.5.2/tasks/sync/sync.thor:47:in `start'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
from /Library/Ruby/Gems/2.0.0/gems/docker-sync-0.5.2/bin/docker-sync:14:in `<top (required)>'
from /usr/local/bin/docker-sync:23:in `load'
from /usr/local/bin/docker-sync:23:in `<main>'
I use docker-sync-stack clean and after then I work normally. But when I restart my docker machine, this error reappears.
I've tried "docker-sync-stack clean" before docker-sync start, but when i do docker-sync stop I get again the error:
Library/Ruby/Gems/2.3.0/gems/docker-sync-0.5.2/lib/docker-sync/watch_strategy/unison.rb:30:in `kill': no implicit conversion from nil to integer (TypeError)
I have no daemon.pid in .docker-sync folder, even when it's running. Show i apply any extra configs for the unison strategy ?
Take a look in your .docker-sync/daemon.log - you will see that the watcher crashes, because you are trying to watch more files than your fs allows (Here's the fix).
After increasing the watcher file limit and re-adjusting your sync_excludes + watch_excludes (mine: sync_excludes: ['.DS_Store', '.idea', '.git', 'docker', 'dev', '*.txt', '*.md', '*.log'] and watch_excludes: ['.git', 'node_modules', 'vendor', '.gitignore'] for a Magento2 project) a deamon.pid should be created and it won't crash anymore 😎
I created a PR to address the no implicit conversion from nil to integer (TypeError) exception thrown on docker-sync stop. See #578
I also had this problem. To resolve I had to remove .docker-sync directory then run docker-sync clean.
Most helpful comment
I also had this problem. To resolve I had to remove
.docker-syncdirectory then rundocker-sync clean.