Batch container spawned by localstack isn't added to the same user defined network

Hi All,
I’m new to localstack and I was trying to create and execute a batch job with locakstack docker container by following the documentation: Batch | Docs
The problem I face is that the container spawned by localstack by using my local image is not added to the same user defined network as localstack, as a result I am not able to access any of the resources created using localstack from within this batch container.

Following is my localstack docker compose image :

  localstack:
    container_name: ${LOCALSTACK_DOCKER_CONTAINER_NAME}
    image: localstack/localstack-pro
    ports:
      - "127.0.0.1:4566:4566" # LocalStack Gateway
      - "127.0.0.1:4510-4559:4510-4559" # external services port range
      - "127.0.0.1:443:443" # LocalStack HTTPS Gateway (Pro)
    environment:
      - LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN} # required for Pro
      - DEBUG=1
      - services=s3,ssm,dynamodb,sqs,batch,ecr
      - LAMBDA_EXECUTOR=local
      - DOCKER_HOST=unix:///var/run/docker.sock
      - MAIN_DOCKER_NETWORK=local_dev_network
      - LOCALSTACK_HOST=localstack:4566
    volumes:
      - "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"
    networks:
      - local_dev_network
    env_file:
      - .env

networks:
  local_dev_network:
    name: local_dev_network
    external: false

I tried creating a ecs task / cluster creation using the same localstack service and by following the doc: Elastic Container Service (ECS) | Docs and it was added to the local user defined network . And I could access the localstack resources from within this container.

Any help / inputs on this would be appreciated.

Thanks,
Saurabh M.

Thank you for bringing this to our attention. We now have a solution in progress. I’ll let you know once the code has been merged.

1 Like

Hi @ssm07 — The fix has been merged! Can you please pull the latest Docker image give it a run once again and let us know if it works fine?

Hi @HarshCasper and @crispinzon ,

I have tested the latest localstack pro image and can confirm that batch job container spawned is now being added to the user defined network.

thanks for the response.

1 Like

Thanks for your feedback. Let us know if you encounter any further LocalStack-specific issues :slight_smile: