无法在 macOS 上启动 localstack
Can't start localstack on macOS
使用 Python 3.7.10 和 pip 21.1.2
localstack
由 pip install localstack
安装。
运行命令localstack start
开始,得到
WARNING:localstack.services.plugins: Service "s3" not yet available, retrying...
在document上,有一个类似
的通知
(Note that on MacOS you may have to run TMPDIR=/private$TMPDIR localstack start --docker if $TMPDIR contains a symbolic link that cannot be mounted by Docker.)
但是我再次运行这个命令:
TMPDIR=/private$TMPDIR localstack start --docker
收到此错误:
Traceback (most recent call last):
File "/opt/code/localstack/localstack/services/plugins.py", line 102, in check_infra
check_service_health(api=name, print_error=print_error)
File "/opt/code/localstack/localstack/services/plugins.py", line 121, in check_service_health
raise e
File "/opt/code/localstack/localstack/services/plugins.py", line 117, in check_service_health
plugin.check(expect_shutdown=expect_shutdown, print_error=print_error)
File "/opt/code/localstack/localstack/services/plugins.py", line 45, in check
return self.check_function(expect_shutdown=expect_shutdown, print_error=print_error)
File "/opt/code/localstack/localstack/services/s3/s3_starter.py", line 44, in check_s3
assert isinstance(out['Buckets'], list)
TypeError: 'NoneType' object is not subscriptable
在 office issue 上,有人说从环境中删除 HOSTNAME
。我没设置,是不是关键原因?
为什么会出现这个 famous
问题? (而且总是?)
使用docker-compose
时输出错误
localstack | During handling of the above exception, another exception occurred:
localstack |
localstack | Traceback (most recent call last):
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 102, in check_infra
localstack | check_service_health(api=name, print_error=print_error)
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 121, in check_service_health
localstack | raise e
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 117, in check_service_health
localstack | plugin.check(expect_shutdown=expect_shutdown, print_error=print_error)
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 45, in check
localstack | return self.check_function(expect_shutdown=expect_shutdown, print_error=print_error)
localstack | File "/opt/code/localstack/localstack/services/s3/s3_starter.py", line 44, in check_s3
localstack | assert isinstance(out['Buckets'], list)
localstack | TypeError: 'NoneType' object is not subscriptable
localstack |
localstack | During handling of the above exception, another exception occurred:
localstack |
localstack | Traceback (most recent call last):
localstack | File "/opt/code/localstack/localstack/utils/cli.py", line 223, in main
localstack | subcommand['function'](argv, args)
localstack | File "/opt/code/localstack/localstack/utils/cli.py", line 61, in cmd_infra
localstack | start_infra_locally()
localstack | File "/opt/code/localstack/localstack/utils/bootstrap.py", line 377, in start_infra_locally
localstack | return infra.start_infra()
localstack | File "/opt/code/localstack/localstack/services/infra.py", line 388, in start_infra
localstack | raise e
localstack | File "/opt/code/localstack/localstack/services/infra.py", line 374, in start_infra
localstack | thread = do_start_infra(asynchronous, apis, is_in_docker)
localstack | File "/opt/code/localstack/localstack/services/infra.py", line 460, in do_start_infra
localstack | thread = start_api_services()
localstack | File "/opt/code/localstack/localstack/utils/analytics/profiler.py", line 156, in wrapped
localstack | return f(*args, **kwargs)
localstack | File "/opt/code/localstack/localstack/services/infra.py", line 449, in start_api_services
localstack | check_infra(apis=apis)
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 111, in check_infra
localstack | check_infra(retries - 1, expect_shutdown=expect_shutdown, apis=apis, additional_checks=additional_checks)
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 111, in check_infra
localstack | check_infra(retries - 1, expect_shutdown=expect_shutdown, apis=apis, additional_checks=additional_checks)
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 111, in check_infra
localstack | check_infra(retries - 1, expect_shutdown=expect_shutdown, apis=apis, additional_checks=additional_checks)
localstack | [Previous line repeated 7 more times]
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 109, in check_infra
localstack | raise e
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 102, in check_infra
localstack | check_service_health(api=name, print_error=print_error)
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 121, in check_service_health
localstack | raise e
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 117, in check_service_health
localstack | plugin.check(expect_shutdown=expect_shutdown, print_error=print_error)
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 45, in check
localstack | return self.check_function(expect_shutdown=expect_shutdown, print_error=print_error)
localstack | File "/opt/code/localstack/localstack/services/s3/s3_starter.py", line 44, in check_s3
localstack | assert isinstance(out['Buckets'], list)
localstack | TypeError: 'NoneType' object is not subscriptable
localstack |
localstack | ERROR: 'NoneType' object is not subscriptable
localstack | (. .venv/bin/activate; exec bin/localstack start --host)
localstack | make: *** [Makefile:55: infra] Error 1
localstack | Waiting for all LocalStack services to be ready
localstack | Starting local dev environment. CTRL-C to quit.
localstack | 2021-10-06 06:09:13,229 INFO success: infra entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
localstack |
localstack | LocalStack version: 0.12.12
localstack | LocalStack Docker container id: 388ad2388117
localstack | LocalStack build date: 2021-06-07
localstack | LocalStack build git hash: ea4dcf40
或者,您可以使用 docker-compose 启动 localstack。如下所示创建 docker-compose.yml 文件并使用此命令 docker-compose up 获取完美地从 localstack 开始。一旦 localstack 启动并且 运行,您还可以通过点击 url 作为 http://localhost:4566/health[= 检查所有服务的健康状况12=]
先决条件:
- 如果您还没有安装 Docker,请安装。
version: "3.8"
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack}"
image: localstack/localstack
hostname: localstack
networks:
- test-net
ports:
- "4566:4566"
environment:
- SERVICES=s3,sqs,cloudformation,iam,cloudwatch
- DEBUG=1
- DATA_DIR=/tmp/localstack/data
- LAMBDA_EXECUTOR=docker-reuse
- LAMBDA_REMOTE_DOCKER=false
- LAMBDA_REMOVE_CONTAINERS=true
- DOCKER_HOST=unix:///var/run/docker.sock
- HOST_TMP_FOLDER=${TMPDIR}
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
networks:
test-net:
external: false
driver: bridge
name: test-net
使用 Python 3.7.10 和 pip 21.1.2
localstack
由 pip install localstack
安装。
运行命令localstack start
开始,得到
WARNING:localstack.services.plugins: Service "s3" not yet available, retrying...
在document上,有一个类似
的通知(Note that on MacOS you may have to run TMPDIR=/private$TMPDIR localstack start --docker if $TMPDIR contains a symbolic link that cannot be mounted by Docker.)
但是我再次运行这个命令:
TMPDIR=/private$TMPDIR localstack start --docker
收到此错误:
Traceback (most recent call last):
File "/opt/code/localstack/localstack/services/plugins.py", line 102, in check_infra
check_service_health(api=name, print_error=print_error)
File "/opt/code/localstack/localstack/services/plugins.py", line 121, in check_service_health
raise e
File "/opt/code/localstack/localstack/services/plugins.py", line 117, in check_service_health
plugin.check(expect_shutdown=expect_shutdown, print_error=print_error)
File "/opt/code/localstack/localstack/services/plugins.py", line 45, in check
return self.check_function(expect_shutdown=expect_shutdown, print_error=print_error)
File "/opt/code/localstack/localstack/services/s3/s3_starter.py", line 44, in check_s3
assert isinstance(out['Buckets'], list)
TypeError: 'NoneType' object is not subscriptable
在 office issue 上,有人说从环境中删除 HOSTNAME
。我没设置,是不是关键原因?
为什么会出现这个 famous
问题? (而且总是?)
使用docker-compose
时输出错误localstack | During handling of the above exception, another exception occurred:
localstack |
localstack | Traceback (most recent call last):
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 102, in check_infra
localstack | check_service_health(api=name, print_error=print_error)
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 121, in check_service_health
localstack | raise e
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 117, in check_service_health
localstack | plugin.check(expect_shutdown=expect_shutdown, print_error=print_error)
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 45, in check
localstack | return self.check_function(expect_shutdown=expect_shutdown, print_error=print_error)
localstack | File "/opt/code/localstack/localstack/services/s3/s3_starter.py", line 44, in check_s3
localstack | assert isinstance(out['Buckets'], list)
localstack | TypeError: 'NoneType' object is not subscriptable
localstack |
localstack | During handling of the above exception, another exception occurred:
localstack |
localstack | Traceback (most recent call last):
localstack | File "/opt/code/localstack/localstack/utils/cli.py", line 223, in main
localstack | subcommand['function'](argv, args)
localstack | File "/opt/code/localstack/localstack/utils/cli.py", line 61, in cmd_infra
localstack | start_infra_locally()
localstack | File "/opt/code/localstack/localstack/utils/bootstrap.py", line 377, in start_infra_locally
localstack | return infra.start_infra()
localstack | File "/opt/code/localstack/localstack/services/infra.py", line 388, in start_infra
localstack | raise e
localstack | File "/opt/code/localstack/localstack/services/infra.py", line 374, in start_infra
localstack | thread = do_start_infra(asynchronous, apis, is_in_docker)
localstack | File "/opt/code/localstack/localstack/services/infra.py", line 460, in do_start_infra
localstack | thread = start_api_services()
localstack | File "/opt/code/localstack/localstack/utils/analytics/profiler.py", line 156, in wrapped
localstack | return f(*args, **kwargs)
localstack | File "/opt/code/localstack/localstack/services/infra.py", line 449, in start_api_services
localstack | check_infra(apis=apis)
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 111, in check_infra
localstack | check_infra(retries - 1, expect_shutdown=expect_shutdown, apis=apis, additional_checks=additional_checks)
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 111, in check_infra
localstack | check_infra(retries - 1, expect_shutdown=expect_shutdown, apis=apis, additional_checks=additional_checks)
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 111, in check_infra
localstack | check_infra(retries - 1, expect_shutdown=expect_shutdown, apis=apis, additional_checks=additional_checks)
localstack | [Previous line repeated 7 more times]
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 109, in check_infra
localstack | raise e
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 102, in check_infra
localstack | check_service_health(api=name, print_error=print_error)
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 121, in check_service_health
localstack | raise e
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 117, in check_service_health
localstack | plugin.check(expect_shutdown=expect_shutdown, print_error=print_error)
localstack | File "/opt/code/localstack/localstack/services/plugins.py", line 45, in check
localstack | return self.check_function(expect_shutdown=expect_shutdown, print_error=print_error)
localstack | File "/opt/code/localstack/localstack/services/s3/s3_starter.py", line 44, in check_s3
localstack | assert isinstance(out['Buckets'], list)
localstack | TypeError: 'NoneType' object is not subscriptable
localstack |
localstack | ERROR: 'NoneType' object is not subscriptable
localstack | (. .venv/bin/activate; exec bin/localstack start --host)
localstack | make: *** [Makefile:55: infra] Error 1
localstack | Waiting for all LocalStack services to be ready
localstack | Starting local dev environment. CTRL-C to quit.
localstack | 2021-10-06 06:09:13,229 INFO success: infra entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
localstack |
localstack | LocalStack version: 0.12.12
localstack | LocalStack Docker container id: 388ad2388117
localstack | LocalStack build date: 2021-06-07
localstack | LocalStack build git hash: ea4dcf40
或者,您可以使用 docker-compose 启动 localstack。如下所示创建 docker-compose.yml 文件并使用此命令 docker-compose up 获取完美地从 localstack 开始。一旦 localstack 启动并且 运行,您还可以通过点击 url 作为 http://localhost:4566/health[= 检查所有服务的健康状况12=]
先决条件:
- 如果您还没有安装 Docker,请安装。
version: "3.8"
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack}"
image: localstack/localstack
hostname: localstack
networks:
- test-net
ports:
- "4566:4566"
environment:
- SERVICES=s3,sqs,cloudformation,iam,cloudwatch
- DEBUG=1
- DATA_DIR=/tmp/localstack/data
- LAMBDA_EXECUTOR=docker-reuse
- LAMBDA_REMOTE_DOCKER=false
- LAMBDA_REMOVE_CONTAINERS=true
- DOCKER_HOST=unix:///var/run/docker.sock
- HOST_TMP_FOLDER=${TMPDIR}
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
networks:
test-net:
external: false
driver: bridge
name: test-net