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.

  • Java8 base image has java7 installed docker
  • Docker container command not found or does not exist
  • How to run a bash script in an Alpine Docker container
  • running django worker and daphne in docker container
  • Writting empty object with socket.io
  • Version of Ubuntu being used in a docker container
  • 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

  • Unsupported config option: 'healthcheck'
  • How to ADD sibling directory to Docker image
  • nginx 403 Forbidden error
  • Laravel POST TokenMismatchException for files bigger than 8kb/16KB (and 2MB) when jwilder/nginx-proxy
  • Detect AWS host environment from within a Docker Container
  • 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.