简体   繁体   中英

Building & running a Dockerfile in IntelliJ

My Problem is the following:

If i type this in the command console, it works:

docker build -f src/main/docker/Dockerfile.jvm -t hello . & docker run --name hello --rm -p 8080:8080 hello

But if i try to use it with the "Run-Option" in IntelliJ, it doesnt work. My command above has 9 Steps like the IntelliJ one, but it seems that the 5th fails. Here is the config: 配置

Here the output from the failed build: 构建失败

Here from the successful one: 成功构建

It doesnt even create the Image-Tag like my manual command does.

And last but not least here is the Dockerfile:

FROM fabric8/java-alpine-openjdk11-jre:latest

ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV AB_ENABLED=jmx_exporter

# Be prepared for running in OpenShift too
RUN adduser -G root --no-create-home --disabled-password 1001 \
  && chown -R 1001 /deployments \
  && chmod -R "g+rwX" /deployments \
  && chown -R 1001:root /deployments

COPY target/lib/* /deployments/lib/
COPY target/*-runner.jar /deployments/app.jar
EXPOSE 8080

# run with user 1001
USER 1001

ENTRYPOINT [ "/deployments/run-java.sh" ]

Where is the key Difference? I can stick with the manual one, but the Run-Config would be smoother

There are only 3 files in your build context. It seems weird. You might want to specify the "Context folder" option

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM