romaro2022-04-21 22:23:28
romaro, 2022-04-21 22:23:28

Why can't I move files between containers with the mv command?

I'm trying to move files from one container to another. Copying works without errors:

docker run --rm -it -v <old_volume>:/from:ro -v <new_volume>:/to alpine \
    ash -c "cd /from ; cp -av . /to"

How to make a move?
docker run --rm -it -v postgres-data:/from -v dship-data:/to alpine ash -c "cd /from ; mv -t . /to"

I am getting an error:
mv: can't remove '/to': Resource busy

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question