In our current test setup, we create a docker container where we have a simple file (created with dd if=/dev/zero) which we use fdisk on to create partitions on. This works, until fdisk tries to re-read the partition table. This fails! with a warning and the exit code is non-null. As we want to do more partitions from the script, we now have to resolve to using fdisk || true which is non-ideal, as other errors also get skipped. It seems that fdisk opens de fd to the image file (which I'm reasonably sure also happens with a real disk) does its operation but when calling a re-read of the partition table, the file is still opened by fdisk/busybox. Using the partprobe applet on the image file works fine without fdisk running. I suspect that the fdisk 'write_table' command should probably close the file, write, reread and reopen the file rather then the current write and reread.