简体   繁体   中英

can't stat '.bashrc' in Alpine linux Dockerfile

I'm having a little trouble trying to spool up an Alpine linux container.

My Dockerfile is very simple but I keep getting an error which i havent seen before.

My Dockerfile is as follows;

FROM openjdk:8-jre-alpine

RUN apk update && apk upgrade && apk --update add \
    ruby build-base libstdc++ tzdata bash ttf-dejavu freetype fontconfig wget curl

RUN addgroup -S newuser && adduser -S newuser -G newuser && \
    cd && cp -R .bashrc .profile /home/newuser && \
    mkdir -p /project && \
    chown -R newuser:newuser /home/newuser /project

USER newuser
ENV HOME /home/newuser

The errors i keep seeing are as follows;

cp: can't stat '.bashrc': No such file or directory
cp: can't stat '.profile': No such file or directory

I dont understand whats going on.

Could anyone shed some light on this? I have never used Alpine Linux before.

Alpine Linux only has the sh shell not the bash shell so I don't think that file would exist. I'm pretty sure you can install the bash shell and create your own.bashrc.

Are you sure that the root's home directory actually contains.bashrc and.profile? More likely than not, these are not present. The default shell is ash. Have a look at the image contents.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM