But then the docker command is starting docker and running the same makefile again inside the container, which becomes hellish to reason about. It's probably better to just make a separate script for that instead.
That is odd. Within the docker container, I agree, you probably shouldn't do that. Esp. since Dockerfiles themselves allow you to run a list of shell commands as your entrypoint.