docker - 为什么容器的状态是退出?
问题描述
我将尝试简要说明情况
docker run -d --name kong \
--link kong-database:kong-database \
--link go-server:go-server \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-database" \
-e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
-e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
-e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
-p 8000:8000 \
-p 8443:8443 \
-p 8001:8001 \
-p 8444:8444 \
kong:latest
当我检查容器状态时
"State": {
"Status": "exited",
"Running": false,
"Paused": false,
我试图重新启动它,但它是一样的。
Port bindings
"PortBindings": {
"8000/tcp": [
{
"HostIp": "",
"HostPort": "8000"
}
],
"8001/tcp": [
{
"HostIp": "",
"HostPort": "8001"
}
],
"8443/tcp": [
{
"HostIp": "",
"HostPort": "8443"
}
],
"8444/tcp": [
{
"HostIp": "",
"HostPort": "8444"
我尝试了 GET 请求,但连接被拒绝
curl -X GET http://localhost:8001/status
curl: (7) Failed to connect to localhost port 8001: Connection refused
日志
docker logs -f 6bee8e8b9f5a
2019/04/25 05:10:23 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:337: database needs bootstrap; run 'kong migrations bootstrap'
stack traceback:
[C]: in function 'error'
/usr/local/share/lua/5.1/kong/init.lua:337: in function 'init'
init_by_lua:3: in main chunk
nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:337: database needs bootstrap; run 'kong migrations bootstrap'
stack traceback:
[C]: in function 'error'
/usr/local/share/lua/5.1/kong/init.lua:337: in function 'init'
init_by_lua:3: in main chunk
2019/04/25 05:14:40 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:337: database needs bootstrap; run 'kong migrations bootstrap'
stack traceback:
[C]: in function 'error'
/usr/local/share/lua/5.1/kong/init.lua:337: in function 'init'
init_by_lua:3: in main chunk
nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:337: database needs bootstrap; run 'kong migrations bootstrap'
stack traceback:
[C]: in function 'error'
/usr/local/share/lua/5.1/kong/init.lua:337: in function 'init'
init_by_lua:3: in main chunk
我应该如何将状态更改为运行模式?解决了
curl -X GET http://localhost:8001/status
{"database":{"reachable":true},"server":{"connections_writing":1,"total_requests":4,"connections_handled":4,"connections_accepted":4,"connections_reading":0,"connections_active":1,"connections_waiting":0}
解决方案
推荐阅读
- python - 将列表解包到列表中
- javascript - 使用 vue-chart 渲染反应性图表(未定义属性或方法“数据”)
- mysql - 子查询返回多于 1 行| 是否可以使用“AND NOT IN”?
- javascript - 如果数据来自对象数组而不是普通字符串数组,则 React 中的 Typeahead/Search/Suggestions 逻辑?
- scikit-learn - Scikit-learn MLPRegressor - 如何获得独立于随机种子的结果?
- python - 如何定义两个对立政党之间的平衡
- javascript - Webpack 和复制,同时保留文件结构
- vb.net - 如何以字符串格式从日期时间选择器中提取月份
- mysql - 多次对 Union mysql 进行复杂查询 - 优化器
- javascript - Angular 5 - routerLink 中的 ngx-translate