When launching the container, we can mount the host system directory to it, which is written in the documentation

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

But how do we mount the directory in an already running container? Can I do this with Docker? Saw only solution using third-party code

  • one
    why do you need it? what problem do you solve? - Mikhail Vaysman
  • one
    Jérôme Petazzoni works for Docker I think that if he has this method described as the only solution, then Docker’s means cannot do this. - Mikhail Vaysman
  • one
    I do not see where the link is at least a line of "third-party code." there it is proposed to mount the directory inside the container. Well, yes, this is not implemented directly in the docker program. You can add it yourself if the absence of such a rare opportunity confuses you. - aleksandr barakin
  • @MikhailVaysman let's say, I forgot to mount the directory at startup, so as not to stop the container, I want to mount it on a "hot" one. - while1pass
  • one
    @ while1pass on production you don’t have to do it by hand, and it’s easier to restart the container on your machine. - Mikhail Vaysman

1 answer 1

As far as I know, using standard tools, you cannot mount a data volume to a running container. Much depends on the tasks for which you want to use the volume.

But, you can make the data volume a separate container, and then mount it in the container you need at least through the same sshfs.