Use shell for layer
If you have a build that somehow fails you can with luck log in and inspect the file system of the last known working layer:
$ docker run --rm -it <id_last_working_layer> bash -il
This can also help to see what and where components are actually staged, by the docker build proces.
You can access containers using
bash, do remember that you container should offer the shell specified.
For a already running container:
$ docker exec -it <containername> /bin/bash
If you want to run it yourself (a variation of the first tip)
$ docker run -it --entrypoint /bin/bash <imagename>
Do read the rest of the referenced StackOverflow entry, it holds a lot of good information.