Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

302
Views
What happens when you mv a folder that a docker container volume is using?

Say I run a container like so:

docker run -v /host/folder:/data some-image

if we run mv /host/folder /host/folder2, I am sure bad stuff will happen, and the only solution is to stop the container and restart it?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Docker uses bind mounts a la mount --bind to make volumes available.

Bind mounts behave a lot like hard links. If you hard link foo to bar with ln foo bar, you can rename or remove foo and it won't affect bar because both files point to the same inode. Similarly, if you bind foo to bar with mount --bind foo bar, moving or removing foo/ won't affect bar/.

Let's take a look with two test directories foo and bar:

$ mkdir foo bar
$ touch foo/FOO bar/BAR
$ ls foo/
FOO
$ ls bar/
BAR

If we mount foo on top of bar and then rename foo, bar is unaffected:

$ sudo mount --bind foo bar
$ ls bar/
FOO
$ mv foo foo.renamed
$ ls bar/
FOO
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!