W
W
waltaki2020-04-18 12:56:07
linux
waltaki, 2020-04-18 12:56:07

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/testdeletes 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

6 answer(s)
A
Andrew, 2020-04-18
@deepblack

How to forward a folder from a container to a local folder?

That cannot be done.
-v /root/test:/root/test removes files inside the container

Does not delete, but mounts along this path.
PS Better describe the problem you want to solve.

K
Karpion, 2020-04-18
@Karpion

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.

M
metajiji, 2020-04-19
@metajiji

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

O
ofigenn, 2020-04-19
@ofigenn

Don't use run.
To connect to a running container, you need to use other commands: docker cp or docker exec.

M
maximmonin, 2020-04-19
@maximmonin

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

V
Valentine, 2020-04-23
@ProFfeSsoRr

Is it possible to somehow forward those files that are in the container to the local machine during run?

The opposite is done - the local folder is mounted in the container where it is needed.
Is proftpd running in a container? What does he have in his config, what does he listen to / home like? Well, mount your /home in the container's /home, that's the solution to the problem (if I understood it correctly, of course).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question