我正试着为一个小项目涌入数据库。按照以下链接在ubuntu 17.04上运行docker镜像。 https://hub.docker.com/_/influxdb/
使用以下命令启动容器,并且Influxdb启动完美。
foo@ubuntu:~/software/influxdb$sudo docker run -p 8086:8`enter code here`086 -v $PWD:/var/lib/influxdb influxdb
执行CLI / SHELL获取错误时的以下命令。
foo@ubuntu:~/software/influxdb$ sudo docker run --rm --link=influxdb -it influxdb influx -host influxdb
docker: Error response from daemon: Cannot link to a non running container: /influxdb AS /epic_lumiere/influxdb.
foo@ubuntu:~/software/influxdb$ sudo docker exec -it influxdb influx
Error response from daemon: Container c04706b2bbcd5cfa70f66d156f1b8f513f2214d5bf2f7a0dd3ff517b45774e08 is not running
注意:Influxdb运行正常,我可以使用http。
连接到它foo@ubuntu:~/software/influxdb$ sudo docker run -p 8086:8086 -v $PWD:/var/lib/influxdb influxdb
[I] 2018-02-21T08:21:12Z InfluxDB starting, version 1.4.3, branch 1.4, commit 60d27e6995558f38a39e90b35a92cbac080310a3
[I] 2018-02-21T08:21:12Z Go version go1.9.2, GOMAXPROCS set to 4
[I] 2018-02-21T08:21:12Z Using configuration at: /etc/influxdb/influxdb.conf
[I] 2018-02-21T08:21:12Z Using data dir: /var/lib/influxdb/data service=store
[I] 2018-02-21T08:21:12Z reading file /var/lib/influxdb/wal/_internal/monitor/1/_00001.wal, size 877606 engine=tsm1 service=cacheloader
[I] 2018-02-21T08:21:12Z reading file /var/lib/influxdb/wal/_internal/monitor/1/_00002.wal, size 0 engine=tsm1 service=cacheloader
[I] 2018-02-21T08:21:12Z /var/lib/influxdb/data/_internal/monitor/1 opened in 88.565658ms service=store
[I] 2018-02-21T08:21:12Z opened service service=subscriber
[I] 2018-02-21T08:21:12Z Starting monitor system service=monitor
[I] 2018-02-21T08:21:12Z 'build' registered for diagnostics monitoring service=monitor
[I] 2018-02-21T08:21:12Z 'runtime' registered for diagnostics monitoring service=monitor
[I] 2018-02-21T08:21:12Z 'network' registered for diagnostics monitoring service=monitor
[I] 2018-02-21T08:21:12Z 'system' registered for diagnostics monitoring service=monitor
[I] 2018-02-21T08:21:12Z Starting precreation service with check interval of 10m0s, advance period of 30m0s service=shard-precreation
[I] 2018-02-21T08:21:12Z Starting snapshot service service=snapshot
[I] 2018-02-21T08:21:12Z Starting continuous query service service=continuous_querier
[I] 2018-02-21T08:21:12Z Starting HTTP service service=httpd
[I] 2018-02-21T08:21:12Z Authentication enabled:false service=httpd
[I] 2018-02-21T08:21:12Z Listening on HTTP:[::]:8086 service=httpd
[I] 2018-02-21T08:21:12Z Starting retention policy enforcement service with check interval of 30m0s service=retention
[I] 2018-02-21T08:21:12Z Listening for signals
[I] 2018-02-21T08:21:12Z Sending usage statistics to usage.influxdata.com
[I] 2018-02-21T08:21:12Z Storing statistics in database '_internal' retention policy 'monitor', at interval 10s service=monitor
[httpd] 172.17.0.1 - - [21/Feb/2018:08:22:28 +0000] "HEAD /ping HTTP/1.1" 204 0 "-" "curl/7.52.1" 5ad8ee44-16e0-11e8-8001-000000000000 3075
[I] 2018-02-21T08:51:12Z Retention policy shard deletion check commencing. service=retention
[I] 2018-02-21T09:13:48Z SHOW DATABASES service=query
[httpd] 172.17.0.1 - - [21/Feb/2018:09:13:48 +0000] "GET /query?q=show+databases HTTP/1.1" 200 109 "-" "curl/7.52.1" 86ae24be-16e7-11e8-8002-000000000000 3423
提前致谢,任何帮助。
foo@ubuntu:~/software/influxdb$ sudo docker ps -a | grep influxdb
[sudo] password for foo:
5e73d087fc19 influxdb "/entrypoint.sh infl…" About an hour ago Created sleepy_lumiere
18acacfc6377 influxdb "/entrypoint.sh infl…" 5 days ago Up 5 days 0.0.0.0:8086->8086/tcp loving_benz
97d935acebd7 influxdb "/entrypoint.sh infl…" 5 days ago Exited (255) 5 days ago 0.0.0.0:8086->8086/tcp happy_agnesi
5d6491f9f143 influxdb "/entrypoint.sh infl…" 5 days ago Exited (255) 5 days ago 0.0.0.0:8086->8086/tcp wizardly_bhabha
7d30f3891672 influxdb "/entrypoint.sh infl…" 7 days ago Exited (0) 6 days ago elastic_booth
2a5451537561 influxdb "/entrypoint.sh infl…" 7 days ago Exited (255) 7 days ago 0.0.0.0:8086->8086/tcp flamboyant_ride6
646581f7bcf9 influxdb "/entrypoint.sh infl…" 7 days ago Exited (0) 7 days ago competent_blackwell
c04706b2bbcd influxdb "/entrypoint.sh infl…" 8 days ago Created influxdb
97fcd152046d influxdb "/entrypoint.sh infl…" 8 days ago Exited (0) 7 days ago flamboyant_tereshkova
ee562bceaa51 influxdb "/entrypoint.sh infl…" 8 days ago Exited (0) 8 days ago objective_cray
问题解决了,以下是我需要执行的命令,以便为Influxdb运行cli / shell(感谢rajiv)
foo@ubuntu:~/software/influxdb$sudosudo docker run --rm --link=<container_name> -it influxdb influx -host <container_name>
答案 0 :(得分:0)
你必须使用Influxdb容器的实际名称来运行它,即loving_benz。下面的命令应该有效。
sudo docker run --rm --link = loving_benz -it Influxdb Influx -host loving_benz