所以,这是到目前为止的故事,
我有一个名为dockerstreamset / datacollector(https://github.com/streamsets/datacollector-docker/blob/master/Dockerfile
)@ https://hub.docker.com/r/streamsets/datacollector/
的基本docker镜像
现在在此docker文件中,设置了一堆环境变量,然后sdc-configure.sh
调用这些环境/参数变量,并设置您的框架以及入口点。
现在我派生了一个基本的docker镜像,如下所示,希望它会覆盖基本镜像中设置的所有env和参数。(我们称其为Dockerfile.child)
ARG SDC_VERSION=3.8.0
ARG SDC_HOME="/app/streamsets/treamsets-datacollector"
ARG SDC_URL="https://archives.streamsets.com/datacollector/3.8.0/tarball/streamsets-datacollector-core-3.8.0.tgz"
ARG SDC_USER=sdc
ARG SDC_UID=20159
ARG SDC_GID=20159
FROM streamsets/datacollector:${SDC_VERSION}
ENTRYPOINT []
ENV SDC_CONF=${SDC_HOME}/etc \
SDC_DATA={SDC_HOME}/data \
SDC_DIST=${SDC_HOME} \
SDC_HOME=${SDC_HOME} \
SDC_LOG=${SDC_HOME}/logs \
SDC_RESOURCES=${SDC_HOME}/resources \
USER_LIBRARIES_DIR=${SDC_HOME}/streamsets-datacollector-user-libs
ENV STREAMSETS_LIBRARIES_EXTRA_DIR="${SDC_DIST}/streamsets-libs-extras"
#RUN chmod 755 /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["dc", "-exec"]
现在,我使用以下命令构建映像
docker build -t test1 -f Dockerfile.child .
->这样可以成功构建,并希望一切都很好,并且会很好。
但是,当我使用docker run --restart on-failure -p 18630:18630 test1
运行docker时
它抛出以下错误:
Java 1.8 detected; adding $SDC_JAVA8_OPTS of "-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -Djdk.nio.maxCachedBufferSize=262144" to $SDC_JAVA_OPTS
WARN: Security is enabled and was unable to verify policy file 'file:///opt/streamsets-datacollector-3.8.0/etc/sdc-security.policy'
Picked up JAVA_TOOL_OPTIONS: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap
OpenJDK 64-Bit Server VM warning: Cannot open file **/opt/streamsets-datacollector-3.8.0/logs/gc.log** due to No such file or directory
Exception in thread "main" java.security.AccessControlException: access denied ("java.util.PropertyPermission" "streamsets.bootstrap.customInitializer.class" "read")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1294)
at java.lang.System.getProperty(System.java:717)
at com.streamsets.pipeline.BootstrapMain.main(BootstrapMain.java:107)
似乎Dockerfile.child中设置的新环境变量永远不会覆盖父/基本Docker文件的原始值。如何更改它,以便容器将在子dockerfile中设置的一组新的env变量上运行?
在我的子docker文件中,我以[]覆盖了原始入口点,可能是在子目录中,如果我运行入口点,它将改变。但这种情况并非如此。