Bellowing是我的Dockerfile的一部分,我想用ENV设置一次PATH,在下面的* .sh文件中,他们不需要重新定义$ PATH。 怎么做到这一点?
#!/bin/bash -
bash "./installer/Anaconda3-5.0.1-Linux-x86_64.sh" -u -b
conda upgrade -y --all
在install_anaconda3.sh里面是:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.crif</groupId>
<artifactId>sniperengine</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>sniperengine</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/net.minidev/json-smart -->
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>2.2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-io -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<!-- <version>1.0.0.RELEASE</version> -->
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.6.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.0.pr1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<!-- <exclusions> <exclusion> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-jdbc</artifactId>
</exclusion> </exclusions> -->
</dependency>
<!-- DBCP dependency -->
<!-- https://mvnrepository.com/artifact/commons-dbcp/commons-dbcp -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
<!-- Oracle JDBC driver -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6.2</version>
</dependency>
<!-- <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc7</artifactId>
<version>12.1.0</version> </dependency> -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<scope>system</scope>
<version>12.1.0</version>
<systemPath>${basedir}\src\main\resources\libs\ojdbc7-12.1.0.jar</systemPath>
</dependency>
<dependency>
<groupId>SniperMail</groupId>
<artifactId>SniperMail</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\SniperMail.jar</systemPath>
</dependency>
<dependency>
<groupId>SniperDomain</groupId>
<artifactId>SniperDomain</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\SniperDomain.jar</systemPath>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>poi-3.9</groupId>
<artifactId>poi-3.9</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\poi-3.9.jar</systemPath>
</dependency>
<dependency>
<groupId>commons-lang3-3.3.2</groupId>
<artifactId>commons-lang3-3.3.2</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\commons-lang3-3.3.2.jar</systemPath>
</dependency>
<dependency>
<groupId>poi-ooxml-schemas-3.9</groupId>
<artifactId>poi-ooxml-schemas-3.9</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\poi-ooxml-schemas-3.9.jar</systemPath>
</dependency>
<dependency>
<groupId>xbean-2.3.0</groupId>
<artifactId>xbean-2.3.0</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\xbean-2.3.0.jar</systemPath>
</dependency>
<dependency>
<groupId>xmlbeans-xmlpublic-2.4.0</groupId>
<artifactId>xmlbeans-xmlpublic-2.4.0</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\xmlbeans-xmlpublic-2.4.0.jar</systemPath>
</dependency>
<dependency>
<groupId>poi-ooxml-3.9</groupId>
<artifactId>poi-ooxml-3.9</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\poi-ooxml-3.9.jar</systemPath>
</dependency>
<dependency>
<groupId>ReportBuilder</groupId>
<artifactId>ReportBuilder</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\ReportBuilder.jar</systemPath>
</dependency>
<dependency>
<groupId>velocity</groupId>
<artifactId>velocity-dep</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>SniperGraph</groupId>
<artifactId>SniperGraph</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\SniperGraph.jar</systemPath>
</dependency>
<dependency>
<groupId>SniperGraphDataMapper</groupId>
<artifactId>SniperGraphDataMapper</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\SniperGraphDataMapper.jar</systemPath>
</dependency>
<dependency>
<groupId>BureauConnector</groupId>
<artifactId>BureauConnector</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\BureauConnector.jar</systemPath>
</dependency>
<dependency>
<groupId>SniperScore</groupId>
<artifactId>SniperScore</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\SniperScore.jar</systemPath>
</dependency>
<dependency>
<groupId>SniperFraudRuleEvaluator</groupId>
<artifactId>SniperFraudRuleEvaluator</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\SniperFraudRuleEvaluator.jar</systemPath>
</dependency>
<dependency>
<groupId>inquiry-commons</groupId>
<artifactId>inquiry-commons</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\inquiry-commons.jar</systemPath>
</dependency>
<dependency>
<groupId>ccavutil</groupId>
<artifactId>ccavutil</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\ccavutil.jar</systemPath>
</dependency>
<dependency>
<groupId>xstream-1.4.2</groupId>
<artifactId>xstream-1.4.2</artifactId>
<scope>system</scope>
<version>1.4.2</version>
<systemPath>${basedir}\src\main\resources\libs\xstream-1.4.2.jar</systemPath>
</dependency>
<dependency>
<groupId>match-commons</groupId>
<artifactId>match-commons</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\match-commons.jar</systemPath>
</dependency>
<dependency>
<groupId>SniperValidator</groupId>
<artifactId>SniperValidator</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\SniperValidator.jar</systemPath>
</dependency>
<dependency>
<groupId>SniperMatch</groupId>
<artifactId>SniperMatch</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\SniperMatch.jar</systemPath>
</dependency>
<dependency>
<groupId>Match</groupId>
<artifactId>Match</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\match.jar</systemPath>
</dependency>
<!-- https://mvnrepository.com/artifact/org.codehaus.jackson/jackson-mapper-asl -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.9</version>
</dependency>
<dependency>
<groupId>SniperRule</groupId>
<artifactId>SniperRule</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\SniperRule.jar</systemPath>
</dependency>
<dependency>
<groupId>VerificationConnector</groupId>
<artifactId>VerificationConnector</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\VerificationConnector.jar</systemPath>
</dependency>
<dependency>
<groupId>com.crif.sniper</groupId>
<artifactId>SniperCache</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\SniperCache.jar</systemPath>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.3</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpclient</groupId>
<artifactId>httpclient</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\httpclient-4.3.2.jar</systemPath>
</dependency>
<dependency>
<groupId>org.apache.httpcore</groupId>
<artifactId>httpcore</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\httpcore-4.3.1.jar</systemPath>
</dependency>
<dependency>
<groupId>SniperES</groupId>
<artifactId>SniperES</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\main\resources\libs\SniperES.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
然后我收到了以下错误:
/ bin / sh:install_anaconda3.sh:找不到命令
答案 0 :(得分:0)
您可以设置工作目录,以便在其上下文中运行以下命令:
WORKDIR /usr/local/bin
# run scripts from /usr/local/bin
RUN ./install_anaconda3.sh
RUN ./install_tensorflow.sh
# ...
这样你就不需要$ PATH
了答案 1 :(得分:0)
@Pavel Agarkov,我改为
RUN导出CUDA_HOME = / usr / local / cuda
RUN export PATH =&#34; / root / anaconda3 / bin:$ PATH&#34;
RUN export PATH =&#34; / usr / local / bin:/ opt / local / sbin:$ PATH&#34;
RUN / bin / bash -c&#34; source install_anaconda3.sh&#34; 在install_anaconda3.sh中,它仍然无法获得正确的PATH。