I have a Dockerfile that moves a script, then executes the destination script. The move command seems to be uncompleted by the time of the execution command, causing a “Text file busy” error.
This is unexpected behaviour because
mv script.sh /dir1 && /dir1/script.sh seems like a very simple sequence of commands. I have this in another Dockerfile and it was failing on 9 out of 10 builds.
I’ve created a simple Dockerfile to reproduce this issue: https://github.com/eugenesia/circleci-debug/blob/70f021/Dockerfile .
The build log showing this error is below.
sleep.sh is just a dummy script that sleeps for 30s. The full log is on https://circleci.com/gh/eugenesia/circleci-debug/67 .
... Step 3/3 : RUN mkdir /dir1 && mv /sleep.sh /dir1 && /dir1/sleep.sh ---> Running in f8c19e91fed4 /bin/sh: 1: /dir1/sleep.sh: Text file busy The command '/bin/sh -c mkdir /dir1 && mv /sleep.sh /dir1 && /dir1/sleep.sh' returned a non-zero code: 2 Exited with code 2
Feel free to keep rebuilding to reproduce the error.