Answer the question
In order to leave comments, you need to log in
How to forward a folder from a container to a local folder?
Is it possible to somehow forward those files that are in the container to the local machine during run?
-v /root/test:/root/test
deletes files inside the container (and they were there in the container), that is, there is forwarding from the local to the container. But I need the opposite.
The task initially is as follows:
there is 1 ftp server on the machine, proftpd on port 21, and you need the user to connect to their files on port 21. It is important that on 1 port and these are different users.
Answer the question
In order to leave comments, you need to log in
How to forward a folder from a container to a local folder?
-v /root/test:/root/test removes files inside the container
I didn't understand the problem.
At first glance - you can forward the folder from the host system to the container to the right place. The container will see it as its own, and it will also be accessible from the outside.
Or make the mount as over the network (with the only difference that the network is virtual, the physical part of the network is missing.
Take docker-compose, describe the creation of your containers and volumes, create a named volume, when created, the files will be copied from the container to the host and are available along the path /var/lib/docker/volumes/volume-name/_data
The same files are available inside the container .
Read more in the official doc: https://docs.docker.com/compose/compose-file/#volumes
Don't use run.
To connect to a running container, you need to use other commands: docker cp or docker exec.
The usual practice of working with containers, when you need to move part of the settings outside the container, suggests the following:
You simply mount, for example, the folder -v /tmp:/tmp
And then copy the contents of the necessary folders inside the container via cp -R /root/test /tmp
Next, take it from the folder content. And connects it via -v but you can already tweak its settings
Is it possible to somehow forward those files that are in the container to the local machine during run?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question