Answer the question
In order to leave comments, you need to log in
How to configure a program in a container outside?
Hello, let's say I have a spring application that I placed in a container and it has a config file property or yaml. I want to run this application in a docker container, but I need it to be configured externally. That is, each machine that will run has its own config, which lies somewhere on it. Help me figure out how to do this please
Answer the question
In order to leave comments, you need to log in
Good afternoon!
In fact, there are many options and the answers can be easily found if you search.
Here are a few:
Let's say you're building an image using a Dockerfile. If you want to be able to configure the process of creating an image based on a Dockerfile, then look at instructions such as ARG & ENV. ARG - allows you to define arguments at the stage (before creation) image. ENV - environment defines environment variables.
Accordingly, you can pass these parameters like this:
1) In the case of ARG for docker, use --build-args
. In case of ENV use -e
2) In case of using docker-compose to pass parameter to Dockerfile use environment:
For example,
environment:
- BASE_URL=http://example.com
environment:
- spring.application.name=custom_app
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question