Skip to content

Add DOCKER_FLAGS support for passing extra flags to the emulator container#248

Closed
anisaoshafi wants to merge 3 commits into
mainfrom
devx-852-lstk-ignores-docker_flags-for-emulators
Closed

Add DOCKER_FLAGS support for passing extra flags to the emulator container#248
anisaoshafi wants to merge 3 commits into
mainfrom
devx-852-lstk-ignores-docker_flags-for-emulators

Conversation

@anisaoshafi

@anisaoshafi anisaoshafi commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Problem

lstk had no way to pass arbitrary Docker flags when starting an emulator if you needed to inject environment variables (-e SERVICES=s3,sqs), or extra volume mounts.

The root cause was structural: runtime.ContainerConfig only modeled the options lstk explicitly needed (port bindings, known env vars, the volume mount for persistence).

Fix

Added support for a DOCKER_FLAGS environment variable and a docker_flags field in the [[containers]] config.toml block.
Both accept a raw docker-run-style string (e.g. "-e SERVICES=s3,sqs -v /tmp/data:/data").
The two sources are merged: env var flags apply globally across all containers, config flags apply per-container.

Supported flags: -e/--env, -v/--volume.

@anisaoshafi anisaoshafi force-pushed the devx-852-lstk-ignores-docker_flags-for-emulators branch 3 times, most recently from 955e9e7 to 137a692 Compare May 15, 2026 12:49
@anisaoshafi anisaoshafi force-pushed the devx-852-lstk-ignores-docker_flags-for-emulators branch 5 times, most recently from 8b87446 to ddd5393 Compare May 18, 2026 12:09
@anisaoshafi anisaoshafi force-pushed the devx-852-lstk-ignores-docker_flags-for-emulators branch from ddd5393 to 9fc8b34 Compare May 18, 2026 12:17
@anisaoshafi anisaoshafi force-pushed the devx-852-lstk-ignores-docker_flags-for-emulators branch from 46b389b to 05c78a9 Compare May 18, 2026 12:30
@anisaoshafi anisaoshafi marked this pull request as ready for review May 18, 2026 12:35
@carole-lavillonniere

Copy link
Copy Markdown
Collaborator

@anisaoshafi I don't fully get why we need this new feature.

  • -e SERVICES=s3,sqs: this should be possible using the current config format:

  [env.aws_services]
  SERVICES = "s3,sqs"

  [[containers]]
  type = "aws"
  port = "4566"
  env = ["aws_services"]
  • extra volume mounts: not supported by config yet, but it could:
[[containers]]
type = "aws"
volume = "/tmp/data:/data"

could become:

[[containers]]
type = "aws"
volumes = ["/tmp/data:/data", "/home/me/init:/etc/localstack/init/ready.d:ro"]

Am I missing something?

@anisaoshafi

anisaoshafi commented May 18, 2026

Copy link
Copy Markdown
Collaborator Author

@carole-lavillonniere that's true, there are workarounds for env vars, though not directly for volumes.

In the docs, we support customer DOCKER_FLAGS, and Maureen was expecting this to work out of the box since it works with the old CLI. I took the liberty to support this, but probably should have asked for more input.
@mmaureenliu what do you think?

@mmaureenliu

mmaureenliu commented May 18, 2026

Copy link
Copy Markdown

@carole-lavillonniere that's true, there are workarounds for env vars, though not directly for volumes.

In the docs, we support customer DOCKER_FLAGS, and Maureen was expecting this to work out of the box since it works with the old CLI. I took the liberty to support this, but probably should have asked for more input. @mmaureenliu what do you think?

I like Carole's suggestion if it works. My initial intuition was also to look at the volume config but then realised it was only used for persistence.

It would also be much cleaner than DOCKER_FLAGS - current localstack implementation apparently struggles with space in path

@anisaoshafi anisaoshafi marked this pull request as draft May 19, 2026 07:38
@anisaoshafi

Copy link
Copy Markdown
Collaborator Author

closing for now, will revisit at another point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants