I/O error when trying to remove directory in docker build

44 views Asked by At

I have this Dockerfile in which have some folders I want to remove and I can't use dockerignore file in that scenario.
In order to remove these folder I'm running the following line :

RUN find . -type d \( -name "pipelines" -o -name ".git" \) -exec rm -rf {} + || true

I'm using buildkit to build the image and I'm getting the following error:

#7 0.300 rm: can't remove '/usr/src/code/.git/hooks': I/O error
#7 0.300 rm: can't remove '/usr/src/code/.git/info': I/O error
#7 0.300 rm: can't remove '/usr/src/code/.git/logs/refs/heads': I/O error
#7 0.301 rm: can't remove '/usr/src/code/.git/logs/refs/remotes/origin': I/O error
#7 0.301 rm: can't remove '/usr/src/code/.git/objects/pack': I/O error
#7 0.301 rm: can't remove '/usr/src/code/.git/refs/heads': I/O error

When I run the same line multiple files I see that eventually all the .git files are getting removed but I don't think that is the correct way to do it.

I tried to remove some folders when building docker image but I'm getting I/O error.
The build is running in a Linux VM.

0

There are 0 answers