localstack/setup-localstack

cannot start Localstack on Windows runner

StevenMassaro opened this issue · 2 comments

Using the windows-2019 runner, this action produces this error:

Error: 'charmap' codec can't encode character '\U0001f4bb' in position 1: character maps to <undefined>

It appears that this is a manifestation of https://docs.localstack.cloud/getting-started/faq/#how-to-fix-localstack-cli-python-utf-8-encoding-issue-under-windows, but I would expect that the action would handle this for me.

This relates to localstack/localstack#6051

Turns out that even if you get past this issue, by making the calls manually, you get the following error:

      - name: Start LocalStack
        run: pip install pyopenssl -U && pip install localstack && pip install awscli-local[ver1] && localstack start -d --no-banner && localstack wait -t 30
D:\a\s3-remote-resource-extension\s3-remote-resource-extension>python "C:\hostedtoolcache\windows\Python\3.7.9\x64\Scripts\\localstack" start -d --no-banner 
2024-03-19T18:57:38.416  INFO --- [  MainThread] localstack.utils.bootstrap : Execution of "prepare_host" took 6145.60ms
[18:57:38] preparing environment                               bootstrap.py:623
           configuring container                               bootstrap.py:631
           starting container                                  bootstrap.py:638
2024-03-19T18:57:38.653 ERROR --- [-functhread1] localstack.utils.bootstrap : Error while starting LocalStack container: Docker process returned with errorcode 125
docker: Error response from daemon: Windows does not support privileged mode.
See 'docker run --help'.

2024-03-19T18:57:38.654  INFO --- [-functhread1] localstack.utils.threads   : Thread run method <function Server.do_start_thread.<locals>._run at 0x0000022ADCAE5678>(None) failed: ('Docker process returned with errorcode 125', None, b"docker: Error response from daemon: Windows does not support privileged mode.\nSee 'docker run --help'.\n") Traceback (most recent call last):
  File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\localstack\utils\container_utils\docker_cmd_client.py", line 684, in _run_async_cmd
    stderr,
subprocess.CalledProcessError: Command '['docker', 'run', '--rm', '--name', 'localstack_main', '--privileged', '-v', 'C:\\Users\\runneradmin\\AppData\\Local\\cache\\localstack-cli\\machine.json:/var/lib/localstack/cache\\machine.json', '-v', 'C:\\Users\\runneradmin\\AppData\\Local\\cache\\localstack\\volume:/var/lib/localstack', '-v', '/var/run/docker.sock:/var/run/docker.sock', '--detach', '-p', '127.0.0.1:4566:4566', '-p', '127.0.0.1:4510-4559:4510-4559', '-e', 'CI=true', '-e', 'ACTIVATE_PRO=0', '-e', 'LOCALSTACK_CLI=1', '-e', 'DOCKER_HOST=unix:///var/run/docker.sock', '-e', 'SET_TERM_HANDLER=1', 'localstack/localstack']' returned non-zero exit status 125.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\localstack\utils\threads.py", line 58, in run
    result = self.func(self.params, **kwargs)
  File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\localstack\utils\serving.py", line 168, in _run
    return self.do_run()
  File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\localstack\utils\bootstrap.py", line 484, in do_run
    return self.container.run()
  File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\localstack\utils\bootstrap.py", line 435, in run
    privileged=self.privileged,
  File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\localstack\utils\container_utils\docker_cmd_client.py", line 605, in run_container
    return self._run_async_cmd(cmd, stdin, kwargs.get("name") or "", image_name)
  File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\localstack\utils\container_utils\docker_cmd_client.py", line 698, in _run_async_cmd
    ) from e
localstack.utils.container_utils.container_client.ContainerException: ('Docker process returned with errorcode 125', None, b"docker: Error response from daemon: Windows does not support privileged mode.\nSee 'docker run --help'.\n")

Hi @StevenMassaro,
Thanks for reaching out.

Unfortunately this is an expected behaviour as Windows runners running Docker on Windows and not Docker Desktop, hence the Windows runners are unable to run Linux containers and unfortunately LocalStack is a Linux container.
To work around this issue we kindly ask you to use Linux runners.