dockerfile - From inside the docker container i want to copy the file in to the host machine -
i have docker container runs jar , creates output json file. there way can copy file folder in docker host before docker run exits ? .i have tried below approach , works fine.
docker run image1 docker cp <container id>:<path in container> <host file path>
above command copies file container docker host. work have ensure container doesn't exit in mean time (by using sleep in program thats run in jar). better approach copy file host within container.
the best decision have shared volume container:
docker run -v /volume/on/your/host/machine:/volume/on/container image1
you can read more here https://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/
Comments
Post a Comment