You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/01/10 18:09:03 UTC

[GitHub] [ozone] adoroszlai commented on a change in pull request #2967: HDDS-6163. Change env vars for docker container image

adoroszlai commented on a change in pull request #2967:
URL: https://github.com/apache/ozone/pull/2967#discussion_r781310088



##########
File path: hadoop-ozone/dist/src/main/docker/Dockerfile
##########
@@ -16,7 +16,11 @@
 
 FROM apache/ozone-runner:@docker.ozone-runner.version@
 
-ENV PATH /opt/hadoop/libexec:${PATH}
+ENV PATH=/opt/hadoop/libexec:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/hadoop/bin
+ENV HADOOP_LOG_DIR=
+ENV HADOOP_CONF_DIR=
+ENV OZONE_LOG_DIR=/var/log/hadoop
+ENV OZONE_CONF_DIR=/etc/hadoop

Review comment:
       These variables have been fixed in the newer `ozone-runner` images (https://github.com/apache/ozone-docker-runner/commit/eb129a93536768c121ec351829e07f8e8adc75e5).  I think the right way to land these changes in Ozone is to update the `ozone-runner` version -- submitted #2969 for this.
   
   ```suggestion
   ```

##########
File path: hadoop-ozone/dist/src/main/docker/Dockerfile
##########
@@ -16,7 +16,11 @@
 
 FROM apache/ozone-runner:@docker.ozone-runner.version@
 
-ENV PATH /opt/hadoop/libexec:${PATH}
+ENV PATH=/opt/hadoop/libexec:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/hadoop/bin

Review comment:
       So the problem is that `${PATH}` is replaced with the PATH from the host where the Maven build is run, instead of PATH in the parent Docker image.
   
   I checked that this happens only with Maven build.  If I build the same image directly with Docker, PATH will be fine:
   
   ```
   $ mvn -DskipTests clean package && \
     cd hadoop-ozone/dist/target/ozone-1.3.0-SNAPSHOT && \
     docker build -t temp . && \
     docker run -it --rm temp bash -c 'echo $PATH'
   ...
   /opt/hadoop/libexec:/opt/hadoop/libexec:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/hadoop/bin
   ```
   
   The problem is caused by `docker-maven-plugin`, which [performs filtering](https://dmp.fabric8.io/#build-filtering) and replaces `${PATH}`.  We could turn this off by adding `<filter>false</filter>` to the plugin config.
   
   Note, however, that `$PATH` has duplicate `/opt/hadoop/libexec`, because:
   
   ```
   $ docker run -it --rm apache/ozone-runner:20210329-1 sh -c 'echo $PATH'
   ...
   /opt/hadoop/libexec:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/hadoop/bin
   ```  
   
   Thus we can simply remove the `ENV PATH...` line to avoid the problem.
   
   ```suggestion
   ```
   
   Tested with the above suggestion:
   
   ```
   $ mvn -DskipTests -Pdocker-build -Pdist clean package && \
     docker run -it --rm ${USER}/ozone:1.3.0-SNAPSHOT bash -c 'echo $PATH'
   ...
   /opt/hadoop/libexec:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/hadoop/bin
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org