How do I run a Bash script in an Alpine Docker container?

Alpine comes with ash as the default shell instead of bash.

So you can

  1. Have a shebang defining /bin/bash as the first line of your sayhello.sh, so your file sayhello.sh will begin with bin/sh

    #!/bin/sh
    
  2. Install Bash in your Alpine image, as you seem to expect Bash is present, with such a line in your Dockerfile:

    RUN apk add --no-cache --upgrade bash
    

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)