docker - 从 DockerFile 创建 influxDB
问题描述
我必须从 DockerFile 创建一个 influxDB。我的 DockerFile 是:
FROM influxdb:1.7.6
ENV TZ=America/Los_Angeles
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
run \
-e INFLUXDB_DB=db0 -e INFLUXDB_ADMIN_ENABLED=true \
-e INFLUXDB_ADMIN_USER=admin -e INFLUXDB_ADMIN_PASSWORD=supersecretpassword \
-e INFLUXDB_USER=telegraf -e INFLUXDB_USER_PASSWORD=secretpassword \
-v $PWD:/var/lib/influxdb \
influxdb /init-influxdb.sh
我从( http://man.hubwiz.com/docset/Docker.docset/Contents/Resources/Documents/docs.docker.com/samples/library/influxdb.html)看到了这个创建 influxDB 脚本。现在当我运行docker build -t myinfluximage 。从 DockerFile 目录,我得到以下信息:
Sending build context to Docker daemon 2.048kB
Step 1/4 : FROM influxdb:1.7.6
1.7.6: Pulling from library/influxdb
6f2f362378c5: Pull complete
494c27a8a6b8: Pull complete
7596bb83081b: Pull complete
058194e87993: Pull complete
9382c8196521: Pull complete
651ab765a68f: Pull complete
c8620b54be93: Pull complete
5386872a43f3: Pull complete
Digest: sha256:af07db2e2040b27d4ae4c57b51729503802d22c1632893fe63ea054afe632ecc
Status: Downloaded newer image for influxdb:1.7.6
---> 8a4e8eda54c1
Step 2/4 : ENV TZ=America/Los_Angeles
---> Running in 0a81e476ec84
Removing intermediate container 0a81e476ec84
---> 5144c757b63f
Step 3/4 : RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
---> Running in b619435af05a
Removing intermediate container b619435af05a
---> adee5c481c4a
Step 4/4 : run -e INFLUXDB_DB=db0 -e INFLUXDB_ADMIN_ENABLED=true -e INFLUXDB_ADMIN_USER=admin -e INFLUXDB_ADMIN_PASSWORD=supersecretpassword -e INFLUXDB_USER=telegraf -e INFLUXDB_USER_PASSWORD=secretpassword -v $PWD:/var/lib/influxdb influxdb /init-influxdb.sh
---> Running in 14312c7bd5f4
/bin/sh: 0: Illegal option -
The command '/bin/sh -c -e INFLUXDB_DB=db0 -e INFLUXDB_ADMIN_ENABLED=true -e INFLUXDB_ADMIN_USER=admin -e INFLUXDB_ADMIN_PASSWORD=supersecretpassword -e INFLUXDB_USER=telegraf -e INFLUXDB_USER_PASSWORD=secretpassword -v $PWD:/var/lib/influxdb influxdb /init-influxdb.sh' returned a non-zero code: 2
为什么我在创建数据库脚本时遇到异常。可能的问题是什么?
解决方案
推荐阅读
- sql - 有没有办法将多个 excel 文件中的数据导入 SQL Server?
- ruby-on-rails - Brew 更新中断 openssl
- android - 如何在 Android Compose TextField 的虚拟键盘上启用大写?
- ruby-on-rails - 设计可确认——如何禁用确认功能?
- angular - 从 docker ui 容器调用 api 容器
- angular - 访问物料表标题单元格中的行数据
- python - WinError 87 尝试安装 Kivy
- sql - 可以在连接子句中使用 Json 数据吗?
- xpath - 如何使用 IMPORTXML 和 XPath 返回特定链接地址
- django - 通过 Kubernetes Job 和持久性 Volume Claim 进行 Django 迁移