Docker: How to use bash with an Alpine based docker image?

后端 未结 4 1280
生来不讨喜
生来不讨喜 2020-11-28 17:59

I created a docker image from openjdk:8-jdk-alpine but when I try to execute simple commands I get the following errors:

RUN bash
/bin/sh: bash: not found

R         


        
4条回答
  •  庸人自扰
    2020-11-28 18:34

    To Install bash you can do:

    RUN apk add --update bash && rm -rf /var/cache/apk/*
    

    If you do not want to add extra size to your image, you can use ash or sh that ships with alpine.

    Reference: https://github.com/smebberson/docker-alpine/issues/43

提交回复
热议问题