Answer the question
In order to leave comments, you need to log in
How to set consul kv values when running in docker?
I want to make sure that consul rises in the docker with some values \u200b\u200balready filled in the key-value store.
As far as I understand, the only way to do this is to run consul, then add the necessary values via cli or http. Made this Dockerfile
FROM consul:latest
COPY kv-values.sh /kv-values.sh
RUN chmod 755 /kv-values.sh && sh -c ./kv-values.sh
EXPOSE 8300 8400 8500 8600
ENTRYPOINT ["/kv-values.sh"]
sh: ./kv-values.sh: not found
Answer the question
In order to leave comments, you need to log in
Found 3 ways.
1. The first and correct from the point of view of the appointment of the consul is described here: we
raise the cluster for use as a discovery service and then fill it with data from the client.
https://github.com/deployable/docker-consul
2. The way we have stopped so far is to store data in volume. There are rights issues when deploying a project to a new environment.
3. A crooked and incorrect, but working way is to substitute your script as an entrypoint, which launches 2 scripts - one in the background pings the rise of the consul and fills it with data, the second actually raises the consul itself.
Sample contents of files:
Purely by docker error:
COPY kv-values.sh /kv-values.sh
RUN chmod 755 /kv-values.sh && sh -c ./kv-values.sh
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question