我正在尝试使用步骤here来调试aws-sam应用程序。但是,我无法使Eclipse工具箱进入调试模式。在调试模式下运行的第一步似乎可以正常工作,即项目成功构建并运行测试,如下面的输出所示
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building A sample Java Spring web service created with AWS CodeStar. 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ HelloWorld ---
...
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.aws.codestar.projecttemplates.handler.HelloWorldHandlerTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.036 s - in com.aws.codestar.projecttemplates.handler.HelloWorldHandlerTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ HelloWorld ---
[INFO] Building jar: C:\Users\MyUser\git\AwsJavaSpring\target\HelloWorld-1.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.085 s
[INFO] Finished at: 2018-07-30T11:09:32-04:00
[INFO] Final Memory: 30M/423M
[INFO] ------------------------------------------------------------------------
此后的下一步失败,我无法解释它打印出的错误消息。
[AWS Toolkit] Running command: C:\Users\MyUser\AppData\Roaming\Python\Scripts\sam.exe local invoke GetHelloWorld --debug-port 5858 --event C:\Users\MyUser\git\AwsJavaSpring\s3-json --profile personal --template C:\Users\MyUser\git\AwsJavaSpring\.serverless.template
[AWS Toolkit] Waiting for SAM Local to attach the port 5858
2018-07-30 14:07:30 Invoking com.aws.codestar.projecttemplates.handler.HelloWorldHandler (java8)
2018-07-30 14:07:30 Found credentials in shared credentials file: ~/.aws/credentials
2018-07-30 14:07:30 Decompressing C:\Users\MyUser\git\AwsJavaSpring\target\HelloWorld-1.0.jar
Fetching lambci/lambda:java8 Docker container image......
2018-07-30 14:07:33 Mounting c:\users\MyUser\appdata\local\temp\tmperiiho as /var/task:ro inside runtime container
Traceback (most recent call last):
File "C:\Users\MyUser\AppData\Roaming\Python\Scripts\sam-script.py", line 11, in <module>
load_entry_point('aws-sam-cli==0.4.0', 'console_scripts', 'sam')()
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\samcli\commands\local\invoke\cli.py", line 44, in cli
docker_network, log_file, skip_pull_image, profile) # pragma: no cover
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\samcli\commands\local\invoke\cli.py", line 76, in do_cli
stderr=context.stderr)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\samcli\commands\local\lib\local_lambda.py", line 80, in invoke
stdout=stdout, stderr=stderr)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\samcli\local\lambdafn\runtime.py", line 83, in invoke
self._container_manager.run(container)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\samcli\local\docker\manager.py", line 61, in run
container.create()
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\samcli\local\docker\container.py", line 110, in create
real_container = self.docker_client.containers.create(self._image, **kwargs)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\docker\models\containers.py", line 824, in create
resp = self.client.api.create_container(**create_kwargs)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\docker\api\container.py", line 411, in create_container
return self.create_container_from_config(config, name)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\docker\api\container.py", line 422, in create_container_from_config
return self._result(res, True)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\docker\api\client.py", line 235, in _result
self._raise_for_status(response)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\docker\api\client.py", line 231, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "C:\Users\MyUser\AppData\Roaming\Python\Python27\site-packages\docker\errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 500 Server Error: Internal Server Error ("invalid volume specification: 'c:\users\MyUser\appdata\local\temp\tmperiiho:/var/task:ro'")
[AWS Toolkit] SAM Local invocation done.
我已经使用docker run hello-world
命令测试了docker安装,并且按预期运行。我还确保按照建议的here将环境变量COMPOSE_CONVERT_WINDOWS_PATHS设置为true。
在使基本示例生效时,我在这里缺少什么?这是Windows上的docker问题还是aws eclipse工具包问题?
更新
看起来这是Windows 7上Docker Toolbox的已知issue,目前尚未修复。