通过Dockerfile将密钥库复制到Docker容器

时间:2018-06-27 18:24:05

标签: docker dockerfile

我试图通过DockerFile复制密钥存储,这一点非常重要,要指出我不是在尝试通过SSL运行我的应用程序,我们正在使用密钥存储来存储一些字符串。

Dockerfile

    FROM openjdk:alpine
COPY './target/sistemaclave-api.jar' /usr/local
RUN chmod +x ./usr/local/sistemaclave-api.jar
WORKDIR /services/security/ && COPY keystore.keystore /usr/local/keystore.keystore
WORKDIR /
CMD ["java", "-jar", "-XX:MinHeapFreeRatio=10", "-XX:MaxHeapFreeRatio=30", "-Xmx512m", "-Dspring.profiles.active=sistemactive", "./usr/local/sistemaclave-api.jar"]

结果

Building sistemaclave-api
Step 1/6 : FROM openjdk:alpine
 ---> 6a6a75aac6c9
Step 2/6 : COPY './target/sistemaclave-api.jar' /usr/local
 ---> 1df26898d59d
Removing intermediate container f6ebcbcca97b
Step 3/6 : RUN chmod +x ./usr/local/sistemaclave-api.jar
 ---> Running in 90b5bd148a62
 ---> 73dd00a6c103
Removing intermediate container 90b5bd148a62
Step 4/6 : WORKDIR /services/security/ && COPY keystore.keystore /usr/local/keystore.keystore
 ---> c31545034465
Removing intermediate container 7b3a60de737c
Step 5/6 : WORKDIR /
 ---> 5bdbed8b1d5a
Removing intermediate container fedac096df0c
Step 6/6 : CMD java -jar -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=30 -Xmx512m -Dspring.profiles.active=sistemactive ./usr/local/sistemaclave-api.jar
 ---> Running in 3d7cb6f7b412
 ---> 609fbf13a2fb
Removing intermediate container 3d7cb6f7b412

Successfully built 609fbf13a2fb
Successfully tagged sistemaclave-api:latest

查看容器时,我看到以下内容:

/usr/local # ls
bin                   lib                   share                 sistemaclave-api.jar

在定义的路径中根本看不到密钥库。

知道我在做什么错吗?

0 个答案:

没有答案