Hello! After intensive research I decided to bring this question up to the community. I started learning docker & docker-compose not long ago.
My question is:
How can I get a list of the possible environment variables in the console. They are listed on the docker hub but how can I get if from the image itself? For example, the image nextcloud has listed this environment variables on the website:
PostgreSQL:
POSTGRES_DB Name of the database using postgres.
POSTGRES_USER Username for the database using postgres.
POSTGRES_PASSWORD Password for the database user using postgres.
POSTGRES_HOST Hostname of the database server using postgres.
If you set any values, they will not be asked in the install page on first run. With a complete configuration by using all variables for your database type, you can additionally configure your Nextcloud instance by setting admin user and password (only works if you set both):
NEXTCLOUD_ADMIN_USER Name of the Nextcloud admin user.
NEXTCLOUD_ADMIN_PASSWORD Password for the Nextcloud admin user.
If you want, you can set the data directory, otherwise.......
.................................................................
But when I do
docker inspect nextcloud | jq '.[] | .Config.Env'
I only get this:
[
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"PHPIZE_DEPS=autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c",
"PHP_INI_DIR=/usr/local/etc/php",
"APACHE_CONFDIR=/etc/apache2",
"APACHE_ENVVARS=/etc/apache2/envvars",
"PHP_EXTRA_BUILD_DEPS=apache2-dev",
"PHP_EXTRA_CONFIGURE_ARGS=--with-apxs2 --disable-cgi",
"PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64",
"PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64",
"PHP_LDFLAGS=-Wl,-O1 -pie",
"GPG_KEYS=42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312",
"PHP_VERSION=7.4.22",
"PHP_URL=https://www.php.net/distributions/php-7.4.22.tar.xz",
"PHP_ASC_URL=https://www.php.net/distributions/php-7.4.22.tar.xz.asc",
"PHP_SHA256=8e078cd7d2f49ac3fcff902490a5bb1addc885e7e3b0d8dd068f42c68297bde8",
"PHP_MEMORY_LIMIT=512M",
"PHP_UPLOAD_LIMIT=512M",
"NEXTCLOUD_VERSION=22.0.0"
]
Which is a lot less important than what is listed on the hub. How can I also get those variables?
Best Answer
Docker won't know it. For example, if I made a script that says:
And packaged that inside of a container, there's nothing in the docker packaging that requires you to tell docker about
$SUPER_SECRET_VAR
and since docker can package apps written in lots of languages, there's no universal way to parse every possible application to extract this.You're left with: