docker-alpine
docker-alpine copied to clipboard
the difference between source in alpine 3.10 and 3.16 after add bash
build machine env:
[root@sre-tools daoren]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
[root@sre-tools daoren]# uname -a
Linux sre-tools 5.18.10-1.el7.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 5 16:57:21 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux
Dockerfile 3.10 & 3.16
3.10
#dockerfile3.10
FROM alpine:3.10
# install bash
RUN set -eux \
&& apk add --no-cache tzdata bash
3.16
#dockerfile3.16
FROM alpine:3.16
# install bash
RUN set -eux \
&& apk add --no-cache tzdata bash
step to build
docker build . alpine:3.10-bash -f dockerfile3.10
docker build . alpine:3.16-bash -f dockerfile3.16
run command
3.10
$ docker run --rm -it alpine:3.10-bash
bash-5.0# pwd
/
bash-5.0# echo pwd > /usr/local/bin/123.sh
bash-5.0# source 123.sh
/
bash-5.0#
3.16
$ docker run --rm -it alpine:3.10-bash
bash-5.1# pwd
/
bash-5.1# echo pwd > /usr/local/bin/123.sh
bash-5.1# source 123.sh
bash: 123.sh: No such file or directory
bash-5.1#
why source can't find the 123.sh file in 3.16 ,but in 3.10 , it can find. anyone help me out?
additional, in my mac, i do the same steps . everything looks ok.
$ uname -a
Darwin daorens-MacBook-Pro.local 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:47:26 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T8101 arm64
@oldthreefeng to help figure out why, could you run pwd
before echo pwd > /usr/local/bin/123.sh
?
Then we could know current working directory.
@westwind-sc all current working directory is /
, sorry late to reply
@oldthreefeng Have you been able to figure out why it was not working? I'm facing the same issue now.
@bernisz sorry late to reply , we use ubuntu to avoid this :)