If I have an error in a RUN command in my dockerfile it just carries on to the next one.
Are you sure the command is really returning an error? The following Dockerfile doesn't get to the echo foo:
FROM alpine
RUN false
RUN echo foo
It just gets:
# docker build .
Sending build context to Docker daemon 3.072 kB
Step 0 : FROM alpine
---> 0a3b5ba3277d
Step 1 : RUN false
---> Running in 22485c5e763c
The command '/bin/sh -c false' returned a non-zero code: 1
To check whether your command is really failing, you could try something like this:
FROM alpine
RUN false || echo failed
RUN echo foo
which then gets me:
# docker build .
Sending build context to Docker daemon 3.072 kB
Step 0 : FROM alpine
---> 0a3b5ba3277d
Step 1 : RUN false || echo failed
---> Running in 674f09ae7530
failed
---> 232fd66c5729
Removing intermediate container 674f09ae7530
Step 2 : RUN echo foo
---> Running in c7b541fdb15c
foo
---> dd1bece67e71
Removing intermediate container c7b541fdb15c
Successfully built dd1bece67e71
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With