Reputation: 91
I want to get all the environment-variables available in the docker image for easy configuration at startup.
For example, when the elasticsearch image is started, the xpack.security.enabled variable can be added, etc.
docker run -d -p 9200:9200 --name=elasticsearch-6.5.4 -e xpack.security.enabled=false elasticsearch:6.5.4
How to know what other variables can be configured in this image, as shown in the help documentation?
thank you very much!
Upvotes: 9
Views: 8889
Reputation: 3736
Let's say the image, zookeeper:3.8.0.
docker inspect --format '{{ .Config.Env }}' zookeeper:3.8.0 | column -t -s ' '
[myuser@myhost zookeeper]$ docker --version
Docker version 19.03.5, build 633a0ea838
[myuser@myhost zookeeper]$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
zookeeper 3.8.0 d3d4daa1366e 7 days ago 279MB
[myuser@myhost zookeeper]$ docker inspect --format '{{ .Config.Env }}' zookeeper:3.8.0 | column -t -s ' '
[PATH=/usr/local/openjdk-11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/apache-
zookeeper-3.8.0-bin/bin JAVA_HOME=/usr/local/openjdk-11 LANG=C.UTF-8
JAVA_VERSION=11.0.15 ZOO_CONF_DIR=/conf ZOO_DATA_DIR=/data
ZOO_DATA_LOG_DIR=/datalog ZOO_LOG_DIR=/logs ZOO_TICK_TIME=2000
ZOO_INIT_LIMIT=5 ZOO_SYNC_LIMIT=2 ZOO_AUTOPURGE_PURGEINTERVAL=0
ZOO_AUTOPURGE_SNAPRETAINCOUNT=3 ZOO_MAX_CLIENT_CNXNS=60
ZOO_STANDALONE_ENABLED=true ZOO_ADMINSERVER_ENABLED=true ZOOCFGDIR=/conf]
--format
DOC
And also see commands list of zookeeper:3.8.0 on docker hub
And you should see enviroment variables of zookeeper image on docker hub image description
see Dockerfile on github
you should see the built-in enviroment of zookeeper from zookeeper doc.
For elasticsearch, there don't seem to be that many configuration items defined by the docker image.
[myuser@myhost zookeeper]$ docker inspect --format '{{ .Config.Env }}' elasticsearch:6.5.4
[PATH=/usr/share/elasticsearch/bin:/usr/local/sbin:/usr/local/bin:/us
r/sbin:/usr/bin:/sbin:/bin ELASTIC_CONTAINER=true
JAVA_HOME=/opt/jdk-11.0.1]
So, you should see the official doc of elasticsearch.
Upvotes: 2
Reputation: 139
docker image inspect {image_name}
has a section called "Env" where you can see this info.
Upvotes: 7
Reputation: 11193
It depends on the image. You need to check documentation of the image.
Upvotes: 0