You can also do this in a few steps, starting from the Docker file with instructions to the interactive part. Then
docker build -t image1 .
Now just
docker run -it --name image2 image1 /bin/bash
you have a shell inside, you can do your interactive commands and then do something like
docker commit image2 myuser/myimage:2.1
Document for docker commit
https://docs.docker.com/engine/reference/commandline/commit/
you may need to specify a new CMD or ENTRYPOINT as indicated in the document
Lock container with new CMD and EXPOSE instructions
For example, some images of dockers using wine do this in several steps, install the wine, then launch and configure the software running in the wine, then docker commit
source share