Проблема
Я изучаю этот урок: https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/key-tasks.html
ОС: Win 10 Pro 64 Bit
Maven:
C:\Users\MyUserName>mvn -version
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-28T01:06:16+10:00)
Maven home: C:\Program Files\apache-maven-3.6.2\bin\..
Java version: 1.8.0_221, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_221\jre
Default locale: en_AU, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Java:
C:\Users\MyUserName>java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
C:\Users\MyUserName>javac -version
javac 1.8.0_221
Docker (установлен и работает):
C:\Users\MyUserName>docker -v
Docker version 19.03.2, build 6a30dfc
Настройки Docker в плагине IntelliJ Docker:
Файл> Настройки> Построение, выполнение, развертывание> Докер:
сокет TCP> URL API движка: tcp: // localhost: 2375
Конфигурация Docker Desktop:
- Демон Docker запущен с установленным флажком: «Expose daemon on tcp: // localhost: 2375 без TLS»
Исключение при запускеЛямбда-функция через символ Lambda в App.java (полный журнал предоставляется в конце сообщения):
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localnpipe/v1.35/containers/create
Ожидаемый вывод : Лямбда-функция развернута в локальном контейнере Dockerи запускается.
Когда я запускаю команду Docker вручную, я получаю эту ошибку:
C:\Users\MyUserName>docker run lambci/lambda:java8
Unable to find image 'lambci/lambda:java8' locally
java8: Pulling from lambci/lambda
docker: image operating system "linux" cannot be used on this platform.
See 'docker run --help'.
Я не получаю эту ошибку, когда Docker запускается из IntelliJ.
Полный вывод из журнала IntelliJ:
"C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd" local invoke --template C:\Users\MyUserName\dev\IdeaProjects\Serverless-Project-01\HelloWorldFunction\.aws-sam\build\template.yaml --event "C:\Users\MyUserName\AppData\Local\Temp\[Local] HelloWorldFunction-event.json" HelloWorldFunction
Invoking helloworld.App::handleRequest (java8)
2019-10-05 22:46:08 Found credentials in environment variables.
Fetching lambci/lambda:java8 Docker container image.....
Mounting C:\Users\MyUserName\dev\IdeaProjects\Serverless-Project-01\HelloWorldFunction\.aws-sam\build\HelloWorldFunction as /var/task:ro,delegated inside runtime container
Traceback (most recent call last):
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\api\client.py", line 261, in _raise_for_status
response.raise_for_status()
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\requests\models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localnpipe/v1.35/containers/create
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "runpy.py", line 193, in _run_module_as_main
File "runpy.py", line 85, in _run_code
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\__main__.py", line 12, in <module>
cli(prog_name="sam")
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\telemetry\metrics.py", line 93, in wrapped
raise exception # pylint: disable=raising-bad-type
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\telemetry\metrics.py", line 62, in wrapped
return_value = func(*args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\commands\local\invoke\cli.py", line 90, in cli
parameter_overrides,
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\commands\local\invoke\cli.py", line 150, in do_cli
context.function_name, event=event_data, stdout=context.stdout, stderr=context.stderr
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\commands\local\lib\local_lambda.py", line 97, in invoke
self.local_runtime.invoke(config, event, debug_context=self.debug_context, stdout=stdout, stderr=stderr)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\local\lambdafn\runtime.py", line 83, in invoke
self._container_manager.run(container)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\local\docker\manager.py", line 93, in run
container.create()
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\local\docker\container.py", line 134, in create
real_container = self.docker_client.containers.create(self._image, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\models\containers.py", line 861, in create
resp = self.client.api.create_container(**create_kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\api\container.py", line 429, in create_container
return self.create_container_from_config(config, name)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\api\container.py", line 440, in create_container_from_config
return self._result(res, True)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\api\client.py", line 267, in _result
self._raise_for_status(response)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\api\client.py", line 263, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
docker.errors.ImageNotFound: 404 Client Error: Not Found ("No such image: lambci/lambda:java8")
Я новичок во всем этом, поэтому любая поддержка приветствуется.