首页 > 解决方案 > 从 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

为什么我在创建数据库脚本时遇到异常。可能的问题是什么?

标签: dockerdockerfileinfluxdb

解决方案


推荐阅读