为什么退出容器状态?

时间:2019-04-25 05:19:31

标签: 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}

0 个答案:

没有答案