Localstack starts on Docker, but I can’t access

Asked

Viewed 529 times

1

I run a "Docker Compose" to start a localstack instance with the S3 service. It raises normally, but when trying to use AWS CLI to access it I get the following error:

>  aws --endpoint-url=http://localhost:4572 s3api put-bucket-acl --bucket demo-bucket --acl public-read

Connection was closed before we received a valid response from endpoint URL: "http://localhost:4572/demo-bucket?acl".

My Docker-Compose is:

version: '3.7'
services:
  localstack:
    image: localstack/localstack
    container_name: localstack_service
    ports:
      - "4567-4584:4567-4584"
      - "8055:8080"
    environment:
      - SERVICES=s3
      - DEBUG=1
      - DATA_DIR=/tmp/localstack/data
    volumes:
      - ./tmp/localstack:/tmp/localstack   
      - /var/run/docker.sock:/var/run/docker.sock
networks:
  default:
    name: mock_demo

localstack log on Docker:

> sudo docker-compose up
Creating localstack_demo ... done
Attaching to localstack_demo
localstack_demo | Waiting for all LocalStack services to be ready
localstack_demo | 2020-12-02 12:13:15,643 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
localstack_demo | 2020-12-02 12:13:15,653 INFO supervisord started with pid 13
localstack_demo | 2020-12-02 12:13:16,656 INFO spawned: 'dashboard' with pid 19
localstack_demo | 2020-12-02 12:13:16,659 INFO spawned: 'infra' with pid 20
localstack_demo | 2020-12-02 12:13:16,669 INFO success: dashboard entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
localstack_demo | 2020-12-02 12:13:16,669 INFO exited: dashboard (exit status 0; expected)
localstack_demo | (. .venv/bin/activate; exec bin/localstack start --host)
localstack_demo | 2020-12-02 12:13:17,690 INFO success: infra entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
localstack_demo | LocalStack version: 0.12.1
localstack_demo | Starting local dev environment. CTRL-C to quit.
localstack_demo | 2020-12-02T12:13:20:DEBUG:bootstrap.py: Loading plugins - scope "services", module "localstack": <function register_localstack_plugins at 0x7f25f590d550>
localstack_demo | Waiting for all LocalStack services to be ready
localstack_demo | 2020-12-02T12:13:26:INFO:localstack.utils.analytics.profiler: Execution of "load_plugin_from_path" took 5445.652961730957ms
localstack_demo | 2020-12-02T12:13:26:DEBUG:bootstrap.py: Plugin loading took 5.445866107940674 sec
localstack_demo | 2020-12-02T12:13:26:INFO:localstack.utils.analytics.profiler: Execution of "load_plugins" took 5445.950984954834ms
localstack_demo | Waiting for all LocalStack services to be ready
localstack_demo | Starting edge router (https port 4566)...
localstack_demo | Starting mock S3 service on http port 4566 ...
localstack_demo | 2020-12-02T12:13:28:INFO:localstack.utils.analytics.profiler: Execution of "prepare_environment" took 2094.336986541748ms
localstack_demo | 2020-12-02T12:13:28:INFO:localstack.multiserver: Starting multi API server process on port 35917
localstack_demo | [2020-12-02 12:13:28 +0000] [21] [INFO] Running on https://0.0.0.0:4566 (CTRL + C to quit)
localstack_demo | 2020-12-02T12:13:28:INFO:hypercorn.error: Running on https://0.0.0.0:4566 (CTRL + C to quit)
localstack_demo | [2020-12-02 12:13:28 +0000] [21] [INFO] Running on http://0.0.0.0:35917 (CTRL + C to quit)
localstack_demo | 2020-12-02T12:13:28:INFO:hypercorn.error: Running on http://0.0.0.0:35917 (CTRL + C to quit)
localstack_demo | 2020-12-02 12:13:29,284:API:  * Running on http://0.0.0.0:48135/ (Press CTRL+C to quit)
localstack_demo | Waiting for all LocalStack services to be ready
localstack_demo | Ready.
localstack_demo | 2020-12-02 12:13:38,509:API: 172.20.0.2 - - [02/Dec/2020 12:13:38] "GET / HTTP/1.1" 200 -
localstack_demo | 2020-12-02T12:13:38:INFO:localstack.utils.analytics.profiler: Execution of "start_api_services" took 10317.44408607483ms

The web page of the url "http://localhost:8055/#! /infra" also does not work.

1 answer

2


First, I see you are using the following version of Localstack:

localstack_demo | LocalStack version: 0.12.1

This way, you are accessing the wrong port for your services, as described in Github, all services must be accessed via Edge Port (the default port being 4566):

Note: Starting with version 0.11.0, all Apis are Exposed via a single edge service, which is accessible on http://localhost:4566 by default (customizable via EDGE_PORT, see further Below).

That said, your command would be as follows:

aws --endpoint-url=http://localhost:4566 s3api put-bucket-acl --bucket demo-bucket --acl public-read

Browser other questions tagged

You are not signed in. Login or sign up in order to post.