DEV Community

cambiph
cambiph

Posted on

NPM run scripts exit status in Docker

Hello all,

I am confused to how the exit code from a process inside a container gets passed to docker.
I have a container which runs an npm run script.
The npm run script fails with exit status 1 but it seems that the exit status is not passed to the docker process itself because Bamboo flags the build task as success.

30-Sep-2019 15:43:53    npm ERR! Exit status 1
30-Sep-2019 15:43:53    npm ERR!
30-Sep-2019 15:43:53    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
30-Sep-2019 15:43:53    
30-Sep-2019 15:43:53    npm ERR! A complete log of this run can be found in:
30-Sep-2019 15:43:53    npm ERR!     /root/.npm/_logs/2019-09-30T13_43_53_321Z-debug.log
30-Sep-2019 15:43:54    Stopping containers 
30-Sep-2019 15:43:54    b3efbe0710cc
30-Sep-2019 15:43:54    Removing containers
30-Sep-2019 15:43:55    b3efbe0710cc
30-Sep-2019 15:43:55    Finished task 'Script' with result: Success

The container is started with the docker run command.

Any advice?
Thanks in advance.
Regards

Top comments (1)

Collapse
 
booyaa profile image
Mark Sta Ana •

To get exit codes for containers you want to run `docker container ls -a‘ after the container has run. The exit codes don’t bubble up from the container to the docket run command.