英文:
Running localstack with docker-compose
问题
I'm running localstack setup with docker-compose.yaml and below is the content of docker-compose.yaml
version: "3.8"
services:
localstack:
image: localstack/localstack:latest
container_name: localstack_test
ports:
- "127.0.0.1:4566:4566"
- "127.0.0.1:4463-4499:4463-4499"
environment:
- SERVICES=s3
- DEBUG=1
- DATA_DIR=/tmp/localstack/data
volumes:
- "./.localstack:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
Whenever we try to hit the URL localhost:4566, it returns a blank page in the browser and the docker logs are as below.
localstack | 2023-02-08T13:06:25.695 DEBUG --- [ MainThread] plugin.manager : plugin localstack.hooks.on_infra_ready:extensions_on_infra_ready is disabled
localstack | 2023-02-08T13:06:25.695 DEBUG --- [ MainThread] plugin.manager : instantiating plugin PluginSpec(localstack.hooks.on_infra_ready.initialize_health_info = <function initialize_health_info at 0x7fbfdcf48310>)
localstack | 2023-02-08T13:06:25.695 DEBUG --- [ MainThread] plugin.manager : plugin localstack.hooks.on_infra_ready:initialize_health_info is disabled
localstack | 2023-02-08T13:06:34.860 DEBUG --- [ asgi_gw_0] l.aws.handlers.service : no service set in context, skipping request parsing
localstack | 2023-02-08T13:06:34.864 INFO --- [ asgi_gw_0] localstack.request.http : GET / => 200
Can anyone, please let me know what's the issue here? It was invoking S3 initially without any changes, and then restarting Docker is causing this. Thanks in advance.
英文:
I'm running localstack setup with docker-compose.yaml and below is the content of docker-compose.yaml
version: "3.8"
services:
localstack:
image: localstack/localstack:latest
container_name: localstack_test
ports:
- "127.0.0.1:4566:4566"
- "127.0.0.1:4463-4499:4463-4499"
environment:
- SERVICES=s3
- DEBUG=1
- DATA_DIR=/tmp/localstack/data
volumes:
- "./.localstack:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
Whenever we try to hit the URL localhost:4566, it returns a blank page in browser and the docker logs are as below.
localstack | 2023-02-08T13:06:25.695 DEBUG --- [ MainThread] plugin.manager : plugin localstack.hooks.on_infra_ready:extensions_on_infra_ready is disabled
localstack | 2023-02-08T13:06:25.695 DEBUG --- [ MainThread] plugin.manager : instantiating plugin PluginSpec(localstack.hooks.on_infra_ready.initialize_health_info = <function initialize_health_info at 0x7fbfdcf48310>)
localstack | 2023-02-08T13:06:25.695 DEBUG --- [ MainThread] plugin.manager : plugin localstack.hooks.on_infra_ready:initialize_health_info is disabled
localstack | 2023-02-08T13:06:34.860 DEBUG --- [ asgi_gw_0] l.aws.handlers.service : no service set in context, skipping request parsing
localstack | 2023-02-08T13:06:34.864 INFO --- [ asgi_gw_0] localstack.request.http : GET / => 200
Can anyone, please let me know what's the issue here ? it was invoking s3 initially without any changes and then restarting docker is causing this. Thanks in advance
答案1
得分: 1
使用`localhost:4566`作为S3 ListBuckets命令的行为已在LocalStack 1.0中移除。您可以通过改为调用http://s3.localhost.localstack.cloud:4566来获得此行为。以下是一个示例:
```awslocal s3 mb s3://foo
curl s3.localhost.localstack.cloud:4566
将会正确输出:
而LocalStack日志应输出:
<details>
<summary>英文:</summary>
The behavior that a call to `localhost:4566` would be interpreted as an S3 ListBuckets command was removed with LocalStack 1.0. You can get this behavior by calling instead http://s3.localhost.localstack.cloud:4566. Here's an example:
awslocal s3 mb s3://foo
curl s3.localhost.localstack.cloud:4566
will correctly output:
<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01"><Owner><ID>bcaf1ffd86f41161ca5fb16fd081034f</ID><DisplayName>webfile</DisplayName></Owner><Buckets><Bucket><Name>foo</Name><CreationDate>2023-02-26T23:34:47.000Z</CreationDate></Bucket></Buckets></ListAllMyBucketsResult>
and the localstack logs should output:
2023-02-27T00:34:53.745 INFO --- [ asgi_gw_0] localstack.request.aws : AWS s3.ListBuckets => 200
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论