0

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.

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

Vishnu Ranganathan
  • 1,277
  • 21
  • 45

1 Answers1

1

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/

Derick Bailey
  • 72,004
  • 22
  • 206
  • 219
  • i can't use docker volume because In Native docker we cant see the file system. what i need is to make the macs local directory to be synced with a directory in the docker container. – Vishnu Ranganathan May 23 '17 at 15:28
  • you either `COPY` the folder in the Dockerfile and build process, or you use a volume mount. by the way: i'm on a mac, and i use Docker for Mac all day, every day, with host mounted volumes. not sure where you read that it doesn't work. – Derick Bailey May 23 '17 at 22:57