how to sync mac local directory with native docker container?

i am using native docker for mac and i have a small application running with docker container .

currently i am manually copying the data from my mac to docker container using docker cp command.

  • Docker-machine swarm; how to open ports on VM
  • What is the proper way to update the Ruby bin folder for a docker container?
  • Bluemix: service bound to container does not appear in VCAP_SERVICES
  • Deploying a minimal flask app in docker - server connection issues
  • Nodejs dev environnement with docker volumes
  • How to change “remote process types” for Heroku deploy with Docker
  • i want to make it dynamic, i want to put the data in my local directory which should get sync with docker container .

    example:

    mac local dir : users/vishnu/data/
    

    which should get sync to

    `<Docker-container-ID>:/opt/deploy/`
    

    the container is already running ,i should not release the running container . i can only stop and start . is there a way ?? Thanks in advance

  • Upgrade jdk version of Tomcat docker container to 1.8
  • Docker commit without running
  • Simple Python Docker Script
  • How to run sql script for postgres in docker
  • Docker Swarm Service Can Not Be Reached on Different Node After Period
  • Docker for mac - Not able to connect to a mongo replica set running on host from inside the container
  • One Solution collect form web for “how to sync mac local directory with native docker container?”

    host mounted volume.

    when you docker run you add a -v /Users/vishnu/data:/opt/deploy parameters.

    if you need to add a mounted volume to your existing container, use the Kitematic UI. it’s easier that way. but in general, you should add this when you docker run.

    also, FYI – the idea that you can’t delete a container is an anti-pattern with Docker. if you can’t delete your container, because it would cause too many problems, you’re doing something wrong. https://derickbailey.com/2017/04/05/what-i-learned-by-deleting-all-of-my-docker-images-and-containers/

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.