You can run an intermediate image of a Docker layer, which is probably what you want.
During your build you might need to inspect an image at certain point (step) in the build process e.g. in your Docker build output you’ll see:
Step 17/30 : RUN rm -rf /some/directory
---> Running in 5ab963f2b48d
Where 5ab963f2b48d
is an image ID, and when you list your images, you’d see that ID in the list e.g.
$ docker image ls --all
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> 5ab963f2b48d 7 minutes ago 1.18GB
To run that image (with a terminal) for example, you can simply:
docker run -i -t 5ab963f2b48d /bin/bash
Also see: Run a Docker Image as a Container