Closed hakonhagland closed 2 years ago
I did a little debugging. It seems the problem is that the SHELL
environment variable is unset, this variable must be valid when using local::lib
. On the other hand, if installing with root user then local::lib
is not needed since the script has write access to the installprivlib
directories:
$ perl -MConfig -E'say $Config{installprivlib}'
/usr/share/perl/5.30
and the SHELL
variable is not used here.
By adding ENV SHELL=/bin/bash
to the Dockerfile:
FROM ubuntu:20.04
SHELL ["/bin/bash", "-c"]
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get install -y \
build-essential curl g++ git \
vim sudo wget autoconf libtool \
cmake
ARG user=docker-user
ARG home=/home/$user
RUN useradd --create-home -s /bin/bash $user \
&& echo $user:ubuntu | chpasswd \
&& adduser $user sudo
WORKDIR $home
USER $user
ENV USER=$user
ENV SHELL=/bin/bash
COPY entrypoint.sh $home
ENTRYPOINT ["./entrypoint.sh"]
the SHELL
variable is set correctly.
This solves this issue for me.
I am on Ubuntu 21.10. I have this
Dockerfile
where I create a non-root user:and
entrypoint.sh
script:I build a docker image using:
and then run the image:
which gives output:
So the installation ends with the error:
fileparse(): need a valid pathname at /usr/share/perl/5.30/CPAN/FirstTime.pm line 1413
before it is finished installingPath::Tiny
.If I use the root user instead of the constructed
docker-user
inDockerfile
it works fine.