go-containerregistry
go-containerregistry copied to clipboard
crane rebase : problems with environment variables
I have two java images, one with 11.0.5 and one with 11.0.6. they are both based on the same template. For instance
FROM centos ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-11.0.5.10-0.el8_0.x86_64
RUN yum update -y &&
yum install -y csh &&
yum install -y rng-tools &&
yum install -y hostname &&
yum install -y wget &&
yum install -y passwd &&
yum install -y nc &&
yum install -y expect &&
yum install -y unzip &&
echo "password" | passwd --stdin root
USER root RUN yum install -y java-11-openjdk-devel-11.0.5.10-0.el8_0.x86_64 RUN rm -rf /tmp/*
ENV PATH $JAVA_HOME/bin:$PATH CMD ["/bin/bash"]
Java 11.0.6 version
FROM centos ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-11.0.6.10-0.el8_1.x86_64/
RUN yum update -y &&
yum install -y csh &&
yum install -y rng-tools &&
yum install -y hostname &&
yum install -y wget &&
yum install -y passwd &&
yum install -y nc &&
yum install -y expect &&
yum install -y unzip &&
echo "password" | passwd --stdin root
USER root
RUN yum install -y java-11-openjdk-devel-11.0.6.10-0.el8_1.x86_64 RUN rm -rf /tmp/*
ENV PATH $JAVA_HOME/bin:$PATH CMD ["/bin/bash"]
i created a simple app and extended 11.0.5 FROM java:11.0.5 ADD target/app-1.0-SNAPSHOT.jar / CMD $JAVA_HOME/bin/java -cp /app-1.0-SNAPSHOT.jar com.test.Application
it works with 11.0.5 and if i build the image directly on 11.0.6, it works ok. It simply prints the java version and the value or JAVA_HOME
If i take the 11.0.5 and rebase it, i get the error /usr/lib/jvm/java-11-openjdk-11.0.5.10-0.el8_0.x86_64/bin/java: No such file or directory (its picking up the 11.0.5 env varaible still)
crane rebase --original edoey-docker-dev:5000/application:11.0.5 --rebased edoey-docker-dev:5000/application:11.0.6 --old_base edoey-docker-dev:5000/java:11.0.5 --new_base edoey-docker-dev:5000/java:11.0.6
Is this expected behavior? Cant rebasing not change environment variables set in a base layer?