Docker Community Forums

Share and learn in the Docker community.

Can't use dynamic mount with Docker toolbox 1.8.3 on Mac OSX


(Doldroyd) #1

Hi,
I’m a docker newbie and I am trying to do some simple python development with docker on OSX.

I downloaded and installed the 1.8.3 dmg and can run the hello world program. My troubles seem to come when I’m trying to debug code. I can run code the first time just fine, but if I then change my code and try to run it again it never sees the changes it is acting like the -v in the initial run caches all my source and until I restart the virtual box it holds on to it and won’t let me modify it.

An example:

Sequence of steps.

  1. Start virbualBox and wait for it to fully load
  2. Start Docker Quickstart Terminal
  3. vi hello.py and change the print statement to say Hello from Miami…
  4. docker run --rm -e “PAYLOAD_FILE=hello.payload.json” -v “$PWD”:/worker -w /worker iron/python:2-dev python /worker/hello.py
  5. Output as expected
  6. vi hello.py and change from Miami to Fantasy Island
  7. re-run command from 4 above.
  8. same output as from running 4 - output did not change

I’m including the transcript from the terminal so you can verify what I’m doing

Davids-MacBook-Pro-3:dailyrawendata davidoldroyd$ docker run --rm -e “PAYLOAD_FILE=hello.payload.json” -v “$PWD”:/worker -w /worker iron/python:2-dev python /worker/hello.py
Hi from Miami! Julio Rogo !!!

Here is the payload: {u’name’: u’Julio Rogo’}
Here is the task_id: None
Davids-MacBook-Pro-3:dailyrawendata davidoldroyd$ vi hello.py
Davids-MacBook-Pro-3:dailyrawendata davidoldroyd$ cat hello.py
import sys
sys.path.append(“packages”)
import iron_mq
from iron_worker import *

print ‘Hi from Fantasy Island! %s !!!’ % IronWorker.payload()[‘name’]
print
print ‘Here is the payload: %s’ % IronWorker.payload()
print ‘Here is the task_id: %s’ % IronWorker.task_id()
Davids-MacBook-Pro-3:dailyrawendata davidoldroyd$ docker run --rm -e “PAYLOAD_FILE=hello.payload.json” -v “$PWD”:/worker -w /worker iron/python:2-dev python /worker/hello.py
Hi from Miami! Julio Rogo !!!

Here is the payload: {u’name’: u’Julio Rogo’}
Here is the task_id: None

I read through the forums and on google that there are problems with macs and virtual volumes but all the solutions point to Boot2Docker which I understand was deprecated in 1.8 - right? Anyway, I’m just trying to get the -v to do a dynamic mount rather than a static mount. Any thoughts?

Thank you for your time and assistance,

Dave