Docker AWS Elastic beanstalk 在本地机器 docker build 中没有错误,但是当放在服务器上时,spacy NLP 永远挂起
Posted
技术标签:
【中文标题】Docker AWS Elastic beanstalk 在本地机器 docker build 中没有错误,但是当放在服务器上时,spacy NLP 永远挂起【英文标题】:Docker AWS Elastic beanstalk no error in local machine docker build but spacy NLP hanging forever when put on server 【发布时间】:2020-10-28 04:05:12 【问题描述】:喜欢标题。我已经使用 docker build -t container-name 在本地机器上测试了我的 docker,一切正常,没有任何错误。一旦我通过 CLI EB 上传到 beanstalk,它就会失败。我发现有一部分我在运行 spacy 的中文 NLP 时失败了。其他一切工作正常,但日志中似乎没有错误或任何异常我可以告诉了解如何调试。
我已经尝试了所有可能性,并通过网络查看了无济于事。有一次,来自 EB 的完整日志显示“memoryerror”,在任何情况下我都无法重新创建,但这就是我所拥有的全部线索。以下是日志:
> ---------------------------------------- /var/log/eb-docker/containers/eb-current-app/eb-29f07434a6e4-stdouterr.log
> ----------------------------------------
> 172.31.43.156 - - [07/Jul/2020 17:24:29] "POST /food_autocomplete HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:30] "POST /food_autocomplete HTTP/1.1" 200 -
> 172.31.4.206 - - [07/Jul/2020 17:24:32] "GET / HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:32] "GET / HTTP/1.1" 200 -
> 172.31.27.83 - - [07/Jul/2020 17:24:32] "GET / HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:34] "POST /food_nutrient_modal HTTP/1.1" 200 -
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator CountVectorizer from version
> 0.21.2 when using version 0.23.1. This might lead to breaking code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator TfidfTransformer from
> version 0.21.2 when using version 0.23.1. This might lead to breaking
> code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator LogisticRegression from
> version 0.21.2 when using version 0.23.1. This might lead to breaking
> code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator Pipeline from version 0.21.2
> when using version 0.23.1. This might lead to breaking code or invalid
> results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator CountVectorizer from version
> 0.21.2 when using version 0.23.1. This might lead to breaking code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator TfidfTransformer from
> version 0.21.2 when using version 0.23.1. This might lead to breaking
> code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator LogisticRegression from
> version 0.21.2 when using version 0.23.1. This might lead to breaking
> code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator Pipeline from version 0.21.2
> when using version 0.23.1. This might lead to breaking code or invalid
> results. Use at your own risk. warnings.warn(
> 172.31.43.156 - - [07/Jul/2020 17:24:36] "POST /smart_suggestions HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:38] "POST /food_nutrient_modal HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:39] "POST /addfood HTTP/1.1" 204 -
> 172.31.43.156 - - [07/Jul/2020 17:24:40] "POST /food_table_generate HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:42] "POST /personal_submit HTTP/1.1" 204 -
> /usr/local/lib/python3.8/site-packages/spacy/util.py:271: UserWarning:
> [W031] Model 'en_Reported_outcome_NLP' (0.0.0) requires spaCy v2.2 and
> is incompatible with the current spaCy version (2.3.0). This may lead
> to unexpected results or runtime errors. To resolve this, download a
> newer compatible model or retrain your custom model with the current
> spaCy version. For more details and available updates, run: python -m
> spacy validate warnings.warn(warn_msg)
> 172.31.4.206 - - [07/Jul/2020 17:24:47] "GET / HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:47] "GET / HTTP/1.1" 200 -
> 172.31.27.83 - - [07/Jul/2020 17:24:47] "GET / HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:47] "POST /food_nlp_onthefly HTTP/1.1" 200 - Building prefix dict from the default dictionary ...
> Dumping model to file cache /tmp/jieba.cache Loading model cost 0.990
> seconds. Prefix dict has been built successfully. * Serving Flask app
> "base" (lazy loading) * Environment: development * Debug mode: off
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator CountVectorizer from version
> 0.21.2 when using version 0.23.1. This might lead to breaking code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator TfidfTransformer from
> version 0.21.2 when using version 0.23.1. This might lead to breaking
> code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/utils/deprecation.py:143:
> FutureWarning: The sklearn.linear_model.logistic module is deprecated
> in version 0.22 and will be removed in version 0.24. The corresponding
> classes / functions should instead be imported from
> sklearn.linear_model. Anything that cannot be imported from
> sklearn.linear_model is now part of the private API.
> warnings.warn(message, FutureWarning)
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator LogisticRegression from
> version 0.21.2 when using version 0.23.1. This might lead to breaking
> code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator Pipeline from version 0.21.2
> when using version 0.23.1. This might lead to breaking code or invalid
> results. Use at your own risk. warnings.warn( * Running on
> http://0.0.0.0:5000/ (Press CTRL+C to quit)
> 172.31.4.206 - - [07/Jul/2020 17:23:47] "GET / HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:23:47] "GET / HTTP/1.1" 200 -
> 172.31.27.83 - - [07/Jul/2020 17:23:47] "GET / HTTP/1.1" 200 -
> 172.31.4.206 - - [07/Jul/2020 17:24:02] "GET / HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:02] "GET / HTTP/1.1" 200 -
> 172.31.27.83 - - [07/Jul/2020 17:24:02] "GET / HTTP/1.1" 200 -
> 172.31.4.206 - - [07/Jul/2020 17:24:17] "GET / HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:17] "GET / HTTP/1.1" 200 -
> 172.31.27.83 - - [07/Jul/2020 17:24:17] "GET / HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:21] "GET /personal HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:21] "POST /usertimezone HTTP/1.1" 204 -
> 172.31.43.156 - - [07/Jul/2020 17:24:22] "GET /static/img/favicon.png HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:29] "POST /food_autocomplete HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:30] "POST /food_autocomplete HTTP/1.1" 200 -
> 172.31.4.206 - - [07/Jul/2020 17:24:32] "GET / HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:32] "GET / HTTP/1.1" 200 -
> 172.31.27.83 - - [07/Jul/2020 17:24:32] "GET / HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:34] "POST /food_nutrient_modal HTTP/1.1" 200 -
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator CountVectorizer from version
> 0.21.2 when using version 0.23.1. This might lead to breaking code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator TfidfTransformer from
> version 0.21.2 when using version 0.23.1. This might lead to breaking
> code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator LogisticRegression from
> version 0.21.2 when using version 0.23.1. This might lead to breaking
> code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator Pipeline from version 0.21.2
> when using version 0.23.1. This might lead to breaking code or invalid
> results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator CountVectorizer from version
> 0.21.2 when using version 0.23.1. This might lead to breaking code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator TfidfTransformer from
> version 0.21.2 when using version 0.23.1. This might lead to breaking
> code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator LogisticRegression from
> version 0.21.2 when using version 0.23.1. This might lead to breaking
> code or invalid results. Use at your own risk. warnings.warn(
> /usr/local/lib/python3.8/site-packages/sklearn/base.py:329:
> UserWarning: Trying to unpickle estimator Pipeline from version 0.21.2
> when using version 0.23.1. This might lead to breaking code or invalid
> results. Use at your own risk. warnings.warn(
> 172.31.43.156 - - [07/Jul/2020 17:24:36] "POST /smart_suggestions HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:38] "POST /food_nutrient_modal HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:39] "POST /addfood HTTP/1.1" 204 -
> 172.31.43.156 - - [07/Jul/2020 17:24:40] "POST /food_table_generate HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:42] "POST /personal_submit HTTP/1.1" 204 -
> /usr/local/lib/python3.8/site-packages/spacy/util.py:271: UserWarning:
> [W031] Model 'en_Reported_outcome_NLP' (0.0.0) requires spaCy v2.2 and
> is incompatible with the current spaCy version (2.3.0). This may lead
> to unexpected results or runtime errors. To resolve this, download a
> newer compatible model or retrain your custom model with the current
> spaCy version. For more details and available updates, run: python -m
> spacy validate warnings.warn(warn_msg)
> 172.31.4.206 - - [07/Jul/2020 17:24:47] "GET / HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:47] "GET / HTTP/1.1" 200 -
> 172.31.27.83 - - [07/Jul/2020 17:24:47] "GET / HTTP/1.1" 200 -
> 172.31.43.156 - - [07/Jul/2020 17:24:47] "POST /food_nlp_onthefly HTTP/1.1" 200 - Building prefix dict from the default dictionary ...
> Dumping model to file cache /tmp/jieba.cache Loading model cost 0.990
> seconds. Prefix dict has been built successfully.
>
>
> ---------------------------------------- /var/log/docker-events.log
> ---------------------------------------- 2020-07-07T17:08:43.222801211Z image pull python:3.8.2-buster
> name=agitated_hugle) 2020-07-07T17:09:46.255907751Z container create
> 5e3269e6db83eb7da60b4f011e0038ee847a83a16200482885ccdfc1ee53f4b3
> (image=sha256:938ea8d987340203ade469ba4cbf79ea7af3626bc521c6e4667959b700877892,
> name=interesting_vaughan) 2020-07-07T17:09:46.256131915Z container
> attach
> 5e3269e6db83eb7da60b4f011e0038ee847a83a16200482885ccdfc1ee53f4b3
> (image=sha256:938ea8d987340203ade469ba4cbf79ea7af3626bc521c6e4667959b700877892,
> name=interesting_vaughan) 2020-07-07T17:09:46.295742501Z network
> connect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=5e3269e6db83eb7da60b4f011e0038ee847a83a16200482885ccdfc1ee53f4b3,
> name=bridge, type=bridge) 2020-07-07T17:09:46.734903605Z container
> start 5e3269e6db83eb7da60b4f011e0038ee847a83a16200482885ccdfc1ee53f4b3
> (image=sha256:938ea8d987340203ade469ba4cbf79ea7af3626bc521c6e4667959b700877892,
> name=interesting_vaughan) 2020-07-07T17:09:49.122315926Z container die
> 5e3269e6db83eb7da60b4f011e0038ee847a83a16200482885ccdfc1ee53f4b3
> (exitCode=0,
> image=sha256:938ea8d987340203ade469ba4cbf79ea7af3626bc521c6e4667959b700877892,
> name=interesting_vaughan) 2020-07-07T17:09:49.171805355Z network
> disconnect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=5e3269e6db83eb7da60b4f011e0038ee847a83a16200482885ccdfc1ee53f4b3,
> name=bridge, type=bridge) 2020-07-07T17:09:49.813444357Z container
> destroy
> 5e3269e6db83eb7da60b4f011e0038ee847a83a16200482885ccdfc1ee53f4b3
> (image=sha256:938ea8d987340203ade469ba4cbf79ea7af3626bc521c6e4667959b700877892,
> name=interesting_vaughan) 2020-07-07T17:09:49.831035003Z container
> create
> 55647e02051fdd853af507483370a89e29e916ef618c0f8dff83b88054d157ed
> (image=sha256:8c7a43e1019f42bc7153ec0b4d142740110250db72ae1475d44d3fa9d16e771d,
> name=friendly_goldstine) 2020-07-07T17:09:49.831391340Z container
> attach
> 55647e02051fdd853af507483370a89e29e916ef618c0f8dff83b88054d157ed
> (image=sha256:8c7a43e1019f42bc7153ec0b4d142740110250db72ae1475d44d3fa9d16e771d,
> name=friendly_goldstine) 2020-07-07T17:09:49.884733812Z network
> connect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=55647e02051fdd853af507483370a89e29e916ef618c0f8dff83b88054d157ed,
> name=bridge, type=bridge) 2020-07-07T17:09:50.290165549Z container
> start 55647e02051fdd853af507483370a89e29e916ef618c0f8dff83b88054d157ed
> (image=sha256:8c7a43e1019f42bc7153ec0b4d142740110250db72ae1475d44d3fa9d16e771d,
> name=friendly_goldstine) 2020-07-07T17:09:53.138031459Z container die
> 55647e02051fdd853af507483370a89e29e916ef618c0f8dff83b88054d157ed
> (exitCode=0,
> image=sha256:8c7a43e1019f42bc7153ec0b4d142740110250db72ae1475d44d3fa9d16e771d,
> name=friendly_goldstine) 2020-07-07T17:09:53.195435239Z network
> disconnect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=55647e02051fdd853af507483370a89e29e916ef618c0f8dff83b88054d157ed,
> name=bridge, type=bridge) 2020-07-07T17:09:53.294312475Z container
> destroy
> 55647e02051fdd853af507483370a89e29e916ef618c0f8dff83b88054d157ed
> (image=sha256:8c7a43e1019f42bc7153ec0b4d142740110250db72ae1475d44d3fa9d16e771d,
> name=friendly_goldstine) 2020-07-07T17:09:53.313349292Z container
> create
> c3c43c4db5b583beb1fbe2161bd73b7a6ea4411b58366f4f043db51b6e2412b0
> (image=sha256:f973e6783f1cb4b492fdf837be75718d5cd396707432a9dbebab795c7a8f1c29,
> name=crazy_cartwright) 2020-07-07T17:09:53.313571816Z container attach
> c3c43c4db5b583beb1fbe2161bd73b7a6ea4411b58366f4f043db51b6e2412b0
> (image=sha256:f973e6783f1cb4b492fdf837be75718d5cd396707432a9dbebab795c7a8f1c29,
> name=crazy_cartwright) 2020-07-07T17:09:53.362840973Z network connect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=c3c43c4db5b583beb1fbe2161bd73b7a6ea4411b58366f4f043db51b6e2412b0,
> name=bridge, type=bridge) 2020-07-07T17:09:53.774896296Z container
> start c3c43c4db5b583beb1fbe2161bd73b7a6ea4411b58366f4f043db51b6e2412b0
> (image=sha256:f973e6783f1cb4b492fdf837be75718d5cd396707432a9dbebab795c7a8f1c29,
> name=crazy_cartwright) 2020-07-07T17:10:30.678618014Z container die
> c3c43c4db5b583beb1fbe2161bd73b7a6ea4411b58366f4f043db51b6e2412b0
> (exitCode=0,
> image=sha256:f973e6783f1cb4b492fdf837be75718d5cd396707432a9dbebab795c7a8f1c29,
> name=crazy_cartwright) 2020-07-07T17:10:30.740972059Z network
> disconnect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=c3c43c4db5b583beb1fbe2161bd73b7a6ea4411b58366f4f043db51b6e2412b0,
> name=bridge, type=bridge) 2020-07-07T17:10:31.134171606Z container
> destroy
> c3c43c4db5b583beb1fbe2161bd73b7a6ea4411b58366f4f043db51b6e2412b0
> (image=sha256:f973e6783f1cb4b492fdf837be75718d5cd396707432a9dbebab795c7a8f1c29,
> name=crazy_cartwright) 2020-07-07T17:10:33.387455304Z container create
> d7445fa259c0281ef92909bae68e0ef640122c3c8aadc8523ccd0ab3168cb439
> (image=sha256:bbe93b4133f847fb8b7217d07fea76d7954db093dced90575f5904437b41bf3e,
> name=angry_hermann) 2020-07-07T17:10:33.476870016Z container destroy
> d7445fa259c0281ef92909bae68e0ef640122c3c8aadc8523ccd0ab3168cb439
> (image=sha256:bbe93b4133f847fb8b7217d07fea76d7954db093dced90575f5904437b41bf3e,
> name=angry_hermann) 2020-07-07T17:10:33.494062931Z container create
> bc23ff300c23cff0b00d12faab49a790a21b9e3bdc8879039afd236163de3cca
> (image=sha256:e4dac3e5b2864c76b1be5c0a9931a23c29d30896eb3deae344dce336ddbb11e5,
> name=admiring_driscoll) 2020-07-07T17:10:33.573500812Z container
> destroy
> bc23ff300c23cff0b00d12faab49a790a21b9e3bdc8879039afd236163de3cca
> (image=sha256:e4dac3e5b2864c76b1be5c0a9931a23c29d30896eb3deae344dce336ddbb11e5,
> name=admiring_driscoll) 2020-07-07T17:10:33.592409924Z image tag
> sha256:a01459d6ad267dabc254bb7b7cd75af0179b81cfdf6762d9bfa13691b2f2d536
> (name=aws_beanstalk/staging-app:latest) 2020-07-07T17:10:36.173605128Z
> container create
> 65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e
> (image=a01459d6ad26, name=goofy_easley) 2020-07-07T17:10:36.223247839Z
> network connect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e,
> name=bridge, type=bridge) 2020-07-07T17:10:36.637664357Z container
> start 65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e
> (image=a01459d6ad26, name=goofy_easley) 2020-07-07T17:10:41.964896576Z
> image tag
> sha256:a01459d6ad267dabc254bb7b7cd75af0179b81cfdf6762d9bfa13691b2f2d536
> (name=aws_beanstalk/current-app:latest) 2020-07-07T17:10:42.012166449Z
> image untag
> sha256:a01459d6ad267dabc254bb7b7cd75af0179b81cfdf6762d9bfa13691b2f2d536
> (name=sha256:a01459d6ad267dabc254bb7b7cd75af0179b81cfdf6762d9bfa13691b2f2d536)
> 2020-07-07T17:10:42.740687237Z image tag
> sha256:a01459d6ad267dabc254bb7b7cd75af0179b81cfdf6762d9bfa13691b2f2d536
> (name=aws_beanstalk/current-app:latest) 2020-07-07T17:10:42.836810391Z
> image tag
> sha256:4f7cd4269fa9900fe43f5c0db2267926ee972cac6cec74a92b9136e49f8b3489
> (name=python:3.8.2-buster) 2020-07-07T17:16:40.255804571Z container
> die 65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e
> (exitCode=137, image=a01459d6ad26, name=goofy_easley)
> 2020-07-07T17:16:40.376674654Z network disconnect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e,
> name=bridge, type=bridge) 2020-07-07T17:16:43.031775619Z network
> connect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e,
> name=bridge, type=bridge) 2020-07-07T17:16:43.789437781Z container
> start 65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e
> (image=a01459d6ad26, name=goofy_easley) 2020-07-07T17:17:07.998859712Z
> container die
> 65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e
> (exitCode=137, image=a01459d6ad26, name=goofy_easley)
> 2020-07-07T17:17:08.142891259Z network disconnect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e,
> name=bridge, type=bridge) 2020-07-07T17:17:10.700159940Z network
> connect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e,
> name=bridge, type=bridge) 2020-07-07T17:17:11.346017877Z container
> start 65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e
> (image=a01459d6ad26, name=goofy_easley) 2020-07-07T17:23:30.234526457Z
> image tag
> sha256:a01459d6ad267dabc254bb7b7cd75af0179b81cfdf6762d9bfa13691b2f2d536
> (name=aws_beanstalk/current-app:latest) 2020-07-07T17:23:30.281059141Z
> image tag
> sha256:4f7cd4269fa9900fe43f5c0db2267926ee972cac6cec74a92b9136e49f8b3489
> (name=python:3.8.2-buster) 2020-07-07T17:23:32.677604215Z image pull
> python:3.8.2-buster (name=python) 2020-07-07T17:23:33.765347130Z image
> tag
> sha256:a01459d6ad267dabc254bb7b7cd75af0179b81cfdf6762d9bfa13691b2f2d536
> (name=aws_beanstalk/staging-app:latest) 2020-07-07T17:23:34.638892876Z
> image tag
> sha256:a01459d6ad267dabc254bb7b7cd75af0179b81cfdf6762d9bfa13691b2f2d536
> (name=aws_beanstalk/staging-app:latest) 2020-07-07T17:23:34.721945923Z
> container create
> 29f07434a6e45cb922cdde01f615fadb13962602050e7330821ca7efe4234e97
> (image=a01459d6ad26, name=pensive_taussig)
> 2020-07-07T17:23:34.777140048Z network connect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=29f07434a6e45cb922cdde01f615fadb13962602050e7330821ca7efe4234e97,
> name=bridge, type=bridge) 2020-07-07T17:23:35.225632098Z container
> start 29f07434a6e45cb922cdde01f615fadb13962602050e7330821ca7efe4234e97
> (image=a01459d6ad26, name=pensive_taussig)
> 2020-07-07T17:23:40.730637840Z container kill
> 65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e
> (image=a01459d6ad26, name=goofy_easley, signal=15)
> 2020-07-07T17:23:50.749346961Z container kill
> 65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e
> (image=a01459d6ad26, name=goofy_easley, signal=9)
> 2020-07-07T17:23:51.007134732Z container die
> 65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e
> (exitCode=137, image=a01459d6ad26, name=goofy_easley)
> 2020-07-07T17:23:51.064061323Z network disconnect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e,
> name=bridge, type=bridge) 2020-07-07T17:23:51.079435605Z container
> stop 65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e
> (image=a01459d6ad26, name=goofy_easley) 2020-07-07T17:23:51.254045082Z
> container destroy
> 65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e
> (image=a01459d6ad26, name=goofy_easley) 2020-07-07T17:23:51.303433852Z
> image tag
> sha256:a01459d6ad267dabc254bb7b7cd75af0179b81cfdf6762d9bfa13691b2f2d536
> (name=aws_beanstalk/current-app:latest) 2020-07-07T17:23:51.350189423Z
> image untag
> sha256:a01459d6ad267dabc254bb7b7cd75af0179b81cfdf6762d9bfa13691b2f2d536
> (name=sha256:a01459d6ad267dabc254bb7b7cd75af0179b81cfdf6762d9bfa13691b2f2d536)
> 2020-07-07T17:25:13.302167787Z container die
> 29f07434a6e45cb922cdde01f615fadb13962602050e7330821ca7efe4234e97
> (exitCode=137, image=a01459d6ad26, name=pensive_taussig)
> 2020-07-07T17:25:13.478841157Z network disconnect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=29f07434a6e45cb922cdde01f615fadb13962602050e7330821ca7efe4234e97,
> name=bridge, type=bridge) 2020-07-07T17:25:16.050466851Z network
> connect
> 0313ee36f6c330fb7f0435db1997443faa3aec1cf0aa895a68bce628065eece5
> (container=29f07434a6e45cb922cdde01f615fadb13962602050e7330821ca7efe4234e97,
> name=bridge, type=bridge) 2020-07-07T17:25:16.806548828Z container
> start 29f07434a6e45cb922cdde01f615fadb13962602050e7330821ca7efe4234e97
> (image=a01459d6ad26, name=pensive_taussig)
>
>
> ---------------------------------------- /var/log/docker
> ---------------------------------------- Jul 7 17:08:13 ip-172-31-2-67 docker: time="2020-07-07
> type="*events.TaskDelete" Jul 7 17:17:07 ip-172-31-2-67 docker:
> time="2020-07-07T17:17:07.984841127Z" level=info msg="ignoring event"
> module=libcontainerd namespace=moby topic=/tasks/delete
> type="*events.TaskDelete" Jul 7 17:23:50 ip-172-31-2-67 docker:
> time="2020-07-07T17:23:50.730877626Z" level=info msg="Container
> 65f83c0b3683725ef5c6e633ef3302f8ee853e4edd5478c900a2a27086421a7e
> failed to exit within 10 seconds of signal 15 - using the force" Jul
> 7 17:23:51 ip-172-31-2-67 docker:
> time="2020-07-07T17:23:51.007035781Z" level=info msg="ignoring event"
> module=libcontainerd namespace=moby topic=/tasks/delete
> type="*events.TaskDelete" Jul 7 17:25:13 ip-172-31-2-67 docker:
> time="2020-07-07T17:25:13.295457935Z" level=info msg="ignoring event"
> module=libcontainerd namespace=moby topic=/tasks/delete
> type="*events.TaskDelete"
>
>
>
> ---------------------------------------- /var/log/nginx/error.log
> ---------------------------------------- 2020/07/07 17:16:38 [error] 5596#0: *144 upstream prematurely closed connection while reading
> response header from upstream, client: 172.31.43.156, server: ,
> request: "POST /food_nlp_onthefly HTTP/1.1", upstream:
> "http://172.17.0.2:5000/food_nlp_onthefly", host:
> "healthbook.humango.co", referrer:
> "https://healthbook.humango.co/personal" 2020/07/07 17:16:39 [error]
> 5596#0: *131 upstream prematurely closed connection while reading
> response header from upstream, client: 172.31.43.156, server: ,
> request: "POST /food_nlp_onthefly HTTP/1.1", upstream:
> "http://172.17.0.2:5000/food_nlp_onthefly", host:
> "healthbook.humango.co", referrer:
> "https://healthbook.humango.co/personal" 2020/07/07 17:16:47 [error]
> 6480#0: *1 connect() failed (111: Connection refused) while connecting
> to upstream, client: 172.31.4.206, server: , request: "GET /
> HTTP/1.1", upstream: "http://172.17.0.2:5000/", host: "172.31.2.67"
> 2020/07/07 17:16:47 [error] 6480#0: *3 connect() failed (111:
> Connection refused) while connecting to upstream, client:
> 172.31.43.156, server: , request: "GET / HTTP/1.1", upstream: "http://172.17.0.2:5000/", host: "172.31.2.67" 2020/07/07 17:16:47
> [error] 6480#0: *5 connect() failed (111: Connection refused) while
> connecting to upstream, client: 172.31.27.83, server: , request: "GET
> / HTTP/1.1", upstream: "http://172.17.0.2:5000/", host: "172.31.2.67"
> 2020/07/07 17:17:07 [error] 6480#0: *7 upstream prematurely closed
> connection while reading response header from upstream, client:
> 172.31.43.156, server: , request: "POST /food_table_generate HTTP/1.1", upstream: "http://172.17.0.2:5000/food_table_generate",
> host: "healthbook.humango.co", referrer:
> "https://healthbook.humango.co/personal"
【问题讨论】:
当您登录 EB 实例,并手动尝试构建和运行您的 docker 时,它是否有效? @Marcin 我使用 CLI EB 来部署 eb 有区别吗?事情是它运行一切正常,除了一小部分代码挂起。然而,当我在本地运行它时,这些部件在我的 docker 上正常工作。我想知道这是否与我的 t2-micro 容器的内存限制有关,因为它是免费层的,但我不敢相信我使用了这么多内存,这对我来说毫无意义:/请告知! 嗨。我的意思是,当您 ssh 进入 EB 实例并像在本地工作站上一样手动运行/构建 docker 时。这样您就可以更密切地监控构建过程、内存使用情况等。 @Marcin 所以你说如果我运行 docker build -t name 我可以看到我使用了多少内存?谢谢! 很遗憾,我不知道您的错误的原因是什么。但是尝试从 EB 实例手动运行 commands/docker 是 EB 常见的故障排除技术。基本上尝试在 EB 实例上手动设置您的容器。通过这种方式,您可以验证它在手动完成时是否有效,或者仅在通过eb
命令自动部署时才会失败。
【参考方案1】:
仅适用于遇到相同问题的任何人:
对我来说,问题是它可以在我的本地机器上运行,但不能在 AWS EB 上运行,但没有错误。问题是上面提到的内存错误。我使用的是免费套餐,因此我的内存限制为 1gb,一旦超过该限制,AWS EB 就会崩溃。
有两种方法可以解决这个问题,这很明显,但对我来说一开始并不明显:
-
将您的层扩展到具有更高内存容量的层
让您的程序更节省内存
我做了后者,问题解决了。
一些有用的命令来帮助你调试:
eb health
检查您的 AWS EB 的内存 cpu 使用情况
docker stats container-name
这让您可以在本地机器上检查 docker 的内存使用情况。 我希望这有帮助。我非常绝望,因为我找不到任何线索(没有任何错误日志)
干杯!
【讨论】:
以上是关于Docker AWS Elastic beanstalk 在本地机器 docker build 中没有错误,但是当放在服务器上时,spacy NLP 永远挂起的主要内容,如果未能解决你的问题,请参考以下文章
AWS Elastic Beanstalk Docker 容器端口映射
AWS Elastic Beanstalk Docker 环境变量
带有 docker 的 AWS Elastic Beanstalk 版本不正确
使用 Dockerrun.aws.json 和 Elastic Beanstalk 命名 Docker 容器