AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1667714
Accepted
Paul Schuldesz
Paul Schuldesz
Asked: 2021-08-06 10:38:02 +0800 CST2021-08-06 10:38:02 +0800 CST 2021-08-06 10:38:02 +0800 CST

Docker 获取可能的环境变量列表

  • 772

你好!经过深入研究,我决定将这个问题提交给社区。不久前我开始学习 docker & docker-compose。

我的问题是:
如何在控制台中获取可能的环境变量列表。它们列在 docker hub 上,但是如果从图像本身中获取,我该如何获取?例如,图像nextcloud在网站上列出了这个环境变量:

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.......
.................................................................

但是当我这样做时

docker inspect nextcloud |  jq '.[] | .Config.Env'

我只得到这个:

[
  "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"
]

这比集线器上列出的要重要得多。我怎样才能得到这些变量?

command-line docker
  • 1 1 个回答
  • 120 Views

1 个回答

  • Voted
  1. Best Answer
    BMitch
    2021-08-06T12:18:04+08:002021-08-06T12:18:04+08:00

    Docker 不会知道的。例如,如果我制作了一个脚本,上面写着:

    #!/bin/sh
    
    if [ -n "$SUPER_SECRET_VAR" ]; then
      echo "Super secret mode enabled"
    else
      echo "Hello world"
    fi
    

    并将其打包在一个容器中,docker 包装中没有任何内容需要您告诉 docker,$SUPER_SECRET_VAR并且由于 docker 可以打包用多种语言编写的应用程序,因此没有通用的方法来解析每个可能的应用程序来提取它。

    你剩下:

    1. 阅读有关图像/应用程序的文档。
    2. 阅读脚本,尤其是入口点脚本。
    3. 阅读代码。
    • 3

相关问题

  • Windows 上是否有可以通过 CMD 或 Powershell 提供加密安全随机字节的设备或可执行文件?

  • Python 的“pass”参数的批处理等价物是什么?

  • 禁用后无法启用 Microsoft Print to PDF

  • 以 root 身份运行 docker 容器

  • 在 Windows 上与 Docker 守护进程通信

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    v15 为什么通过电缆(同轴电缆)的千兆位/秒 Internet 连接不能像光纤一样提供对称速度? 2020-01-25 08:53:31 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve