gpt4 book ai didi

python - FastAPI docker-compose 找不到文件错误

转载 作者:行者123 更新时间:2023-12-02 19:08:18 25 4
gpt4 key购买 nike

我必须运行 full-stack-fastapi-postgresql 生成的项目我被困在启动应用程序的第一步:docker-compose up -d抛出 FileNotFoundError。
我很确定这不是一个难题或问题,只是我错过了一些东西,但我不知道为什么。查看命令运行版本,我很确定我的错误就在这里。

版本:

Docker version 19.03.13, build 4484c46
docker-compose version 1.27.4, build unknown
Poetry version 1.1.4

运行的命令:

pip install cookiecutter

在上面的部分中,我启动了下载并响应 writed 等所有要求(我刚刚输入“Test”作为名称,并为每个询问的密码输入 openssl rand -hex 32 的结果)

$ cookiecutter https://github.com/tiangolo/full-stack-fastapi-postgresql
You've downloaded /Users/jojomoon/.cookiecutters/full-stack-fastapi-postgresql before. Is it okay to delete and re-download it? [yes]: yes
project_name [Base Project]: Test
project_slug [test]:
domain_main [test.com]:
domain_staging [stag.test.com]:
docker_swarm_stack_name_main [test-com]:
docker_swarm_stack_name_staging [stag-test-com]:
secret_key [changethis]: 1280bf10bc3ebdf435834b2fc98e098144700bd27dfc43f62c2dcdd52741a5ac
first_superuser [<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e180858c888fa195849295cf828e8c" rel="noreferrer noopener nofollow">[email protected]</a>]:
first_superuser_password [changethis]: 81ec188f2f509483aeb7d877376220e81b5e4e1694fc4b1ee11028c923e340e8
backend_cors_origins [["http://localhost", "http://localhost:4200", "http://localhost:3000", "http://localhost:8080", "https://localhost", "https://localhost:4200", "https://localhost:3000", "https://localhost:8080", "http://dev.test.com", "https://stag.test.com", "https://test.com", "http://local.dockertoolbox.tiangolo.com", "http://localhost.tiangolo.com"]]:
smtp_port [587]:
smtp_host []:
smtp_user []:
smtp_password []:
smtp_emails_from_email [<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5b32353d341b2f3e282f75383436" rel="noreferrer noopener nofollow">[email protected]</a>]:
postgres_password [changethis]: 39f987c0f2e31a2a594f07eb0e67e2e15766f5a9f93062fc37d0ea66c908279f
pgadmin_default_user [<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="442520292d2a04302137306a272b29" rel="noreferrer noopener nofollow">[email protected]</a>]:
pgadmin_default_user_password [81ec188f2f509483aeb7d877376220e81b5e4e1694fc4b1ee11028c923e340e8]:
traefik_constraint_tag [test.com]:
traefik_constraint_tag_staging [stag.test.com]:
traefik_public_constraint_tag [traefik-public]:
flower_auth [admin:81ec188f2f509483aeb7d877376220e81b5e4e1694fc4b1ee11028c923e340e8]:
sentry_dsn []:
docker_image_prefix []:
docker_image_backend [backend]:
docker_image_celeryworker [celeryworker]:
docker_image_frontend [frontend]:

错误

在生成的 README.md 中,他们说要安装 docker、docker-compose 和诗歌。之后,我启动docker-compose up -d启动项目,然后...(显示第一个错误和最后一行,如果需要,还可以显示更多)。

jojomoon at MacBook-Pro-de-Johann in ~/Desktop/entretien/test 
$ docker-compose up -d
Traceback (most recent call last):
File "/usr/local/Cellar/docker-compose/1.27.4_1/libexec/lib/python3.9/site-packages/urllib3/connectionpool.py", line 670, in urlopen
httplib_response = self._make_request(
File "/usr/local/Cellar/docker-compose/1.27.4_1/libexec/lib/python3.9/site-packages/urllib3/connectionpool.py", line 392, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/Cellar/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b1c1c8c5d9dedff1829f88" rel="noreferrer noopener nofollow">[email protected]</a>/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1255, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/Cellar/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2e5e575a4641406e1d0017" rel="noreferrer noopener nofollow">[email protected]</a>/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1301, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/Cellar/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="41313835292e2f01726f78" rel="noreferrer noopener nofollow">[email protected]</a>/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1250, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/Cellar/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c5b5bcb1adaaab85f6ebfc" rel="noreferrer noopener nofollow">[email protected]</a>/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1010, in _send_output
self.send(msg)
File "/usr/local/Cellar/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6e1e171a0601002e5d4057" rel="noreferrer noopener nofollow">[email protected]</a>/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 950, in send
self.connect()
File "/usr/local/Cellar/docker-compose/1.27.4_1/libexec/lib/python3.9/site-packages/docker/transport/unixconn.py", line 43, in connect
sock.connect(self.unix_socket)
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:
...

File "/usr/local/Cellar/docker-compose/1.27.4_1/libexec/lib/python3.9/site-packages/docker/api/client.py", line 212, in _retrieve_server_version
raise DockerException(
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

请问我做错了什么?我必须在一开始就填写所有要求的值吗?我没有全部,我只想在本地运行这个样板)

最佳答案

您是否正确设置了 docker/virtualbox?例如,对于 MacOS,有一个描述 here 。 TL;DR 复制到此处:

$ brew install docker docker-machine
$ brew cask install virtualbox
-> need password
-> possibly need to address System Preference setting
$ docker-machine create --driver virtualbox default
$ docker-machine env default
$ eval "$(docker-machine env default)"
$ docker run hello-world

关于python - FastAPI docker-compose 找不到文件错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64729870/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com