First, run a new isolated container:
docker run --rm -it ubuntu bash
Now, setup npm and try to install package:
apt-get update && apt-get install -y npm
npm install grunt
You might see some funky garbage in your terminal window. Sometimes, it will hang, so expect to kill your session out of band.
Any thoughts?
I'd suggest using https://github.com/mhart/alpine-node as your base image instead, if only because the version of npm bundled with Ubuntu LTS is old enough to be completely unsupported by the npm CLI team. For more details on what's causing these install failures, see npm/npm#12196 (comment).