ANSWER: I still don't know what was really wrong but after I restarted docker and ran it again (same dockerfile, same everything), it worked fine.
I'm using Docker on Windows and my Dockerfile is
FROM ubuntu:15.04
COPY . /src
RUN apt-get update
RUN apt-get install -y nodejs
...etc
but when I try to build the image I get
WARN[0001] SECURITY WARNING: You are building a Docker image from Windows against a Linux Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories
...
Step 3: RUN apt-get -y update
--> Using cache
--->ccd4120f98dd
Removing intermediate container 255796bdef29
Step 4: RUN apt-get install -y nodejs
---> Running in f6c1d5a54c7a
Reading package lists...
Reading dependency tree...
Reading state information...
E: Unable to locate package nodejs
INFO[0029] The command [/bin/sh -c apt-get install -y nodejs] returned a non-zero code:100
apt-get works but when I try to put other apt-get install lines in those don't work either so it doesn't seem to be a problem with.
I restarted docker and tried again and now it works fine.