I need to use bash in the scripts of a CI/CD pipeline, so I'm trying with this simple image:
FROM alpine:3.4
RUN apk update -q && apk add --no-cache bash -q
SHELL ["/bin/bash", "--login", "-c"]
RUN echo $0
What I get in my terminal is this:
$ docker build .
Sending build context to Docker daemon 2.048kB
Step 1/4 : FROM alpine:3.4
---> b7c5ffe56db7
Step 2/4 : RUN apk update -q && apk add --no-cache bash -q
---> Using cache
---> 18b729da453c
Step 3/4 : SHELL ["/bin/bash", "--login", "-c"]
---> Using cache
---> 03ca0df4a543
Step 4/4 : RUN echo $0
---> Running in a65419dafc4b
/bin/bash
Removing intermediate container a65419dafc4b
---> 2963f9e0e563
Successfully built 2963f9e0e563
After that, I run that container and get this:
$ docker run -it 2963f9e0e563
/ $ echo $0
/bin/sh
/ $
(it runs as root but I changed "#" with "$" for this post)
Why is it using sh instead of bash?