0

I have a container with code in it. This container runs on production server. How can I share folder with code in this container to my local machine? May be with Samba server and then mount (cifs) this folder with code on my machine? May be some examples...

1

1 Answer 1

2

Using

docker cp <containerId>:/file/path/within/container /host/path/target 

you could copy some data from the container. If the data in the container and on your machine need to be in sync constantly I suggest you use a data volume to share a directory from your server with the container. This directory can then be shared from the server to your local machine with any method (e.g. sshfs)

The docker documentation about Manage data in containers shows how to add a volume:

$ docker run -d -P --name web -v /webapp training/webapp python app.py 

The data from you severs training/webapp location will then be available in the docker container at /webapp.

Sign up to request clarification or add additional context in comments.

2 Comments

but folder /webapp will be on the server hdd, not in my pc hdd
@edenisn yes. That's where you would for example use sshfs to mount the servers directory to your local pc. I recommend this way because then your local computer only needs to connect to the server. Connecting into the docker container would be more involved.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.