Circleci 2.0: Custom Docker Image but circleci build is failing


I created a custom docker image that I pushed to docker hub. Here is the docker file:

I then reference that docker image in my config.yml file. Here is the whole file:

The problem is I am receiving this error:
npm install
/bin/bash: npm: command not found

When I ssh into the docker image locally, I can see npm --version returns the proper version and is installed in the docker image, but “circleci build” is acting like it isn’t using my custom docker image.

Am I missing something to make sure my docker image is loaded in circleci 2.0? Or maybe I am missing a step in what I am pushing to docker hub? Any help figuring this out would be appreciated. Thanks!


I just tried running it on my local machine and I get the same error:

docker run chrisroane/frontline-docker-image:0.0.4 npm --version
docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"npm\\\": executable file not found in $PATH\"\n".

So I think something is wrong with the image, as available from Docker Hub.


Thanks FelicianoTech. That is strange because when I log into the docker image locally, it seems to work.

This is the process I am using to push the image to docker hub. Do you see anything I am missing or wrong with these steps?

docker build -t “chrisroane/frontline-docker-image:0.0.4” .
Use hash from above: docker run -it a4f19f09da21 /bin/bash
Use the login hash from above: docker commit c2f58f998a5d chrisroane/frontline-docker-image:0.0.4
docker push chrisroane/frontline-docker-image:0.0.4


I was able to replicate this problem. When I change the command to this, it works:
docker run chrisroane/frontline-docker-image:0.0.6 env | npm --version

This seems to tell me the PATH variable isn’t using what is set from the docker image. Maybe the terminal needs to get refreshed at the end of my docker file? Or how I can get that “env” parameter set when circleci 2.0 uses my docker image?


I’m not sure. I have a few questions about the Dockerfile gist you linked though. I don’t know how much you’ve changed since you posted it, but:

Of course you can set it up however you want but with less “moving parts” we’re more likely to prevent some issues from happening.


I used NVM mainly to make it easy in installing a specific version of node.

If I can’t get this working, I may look for a different base image to start from that has more of what I need installed automatically. But it is weird because the image works as expected when I log in from my local. Thanks for the help.


FYI, I worked through the main issue of this task by re-creating a new docker file. This appears to work perfectly for me and I am able to install a specific version of Node without a problem. Here is the latest dockerfile I am using: