Last active
March 1, 2023 17:10
-
-
Save gadmel/f5cdb3cefb4bb4f35ee76c898d1895f3 to your computer and use it in GitHub Desktop.
Start Docker with environment variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run --env ENV_KEY=env_value -d -p 8080:8080 ImAgE-ID | |
Dockerfile: | |
FROM openjdk:19 | |
EXPOSE 8080 | |
WORKDIR /usr/src/myapp | |
ADD backend/target/app.jar app.jar | |
CMD ["sh", "-c", "java -jar app.jar", "-Dspring.profiles.active=${ENV_KEY}"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
top 👍