Skip to content

Conversation

@9c23a5
Copy link
Contributor

@9c23a5 9c23a5 commented Dec 18, 2025

This PR adds option_args to the command generated when running kamal accessory exec <accessory_name> <command>. These same options are passed when launching the accessory container, which causes inconsistent behaviour.

With this change now new ephemeral containers will be created with the same options as when the application is deployed. This is how kamal app exec works too: https://github.com/basecamp/kamal/blob/main/lib/kamal/commands/app/execution.rb#L10-L24

For example:

# config/deploy.yml
accessories:
  my-accessory:
    image: my-image
    options:
      ulimit: nofile=8192:8192
$ kamal accessory exec my-accessory "sh -c 'ulimit -n'" --reuse
Launching command from existing container...
  INFO [64004c8b] Running docker exec my-accessory sh -c 'ulimit -n' on my-instance
  INFO [64004c8b] Finished in 0.128 seconds with exit status 0 (successful).
App Host: my-instance
8192

$ kamal accessory exec my-accessory "sh -c 'ulimit -n'"
Launching command from new container...
  INFO [b82673a5] Running docker login [...]
  INFO [b82673a5] Finished in 2.001 seconds with exit status 0 (successful).
  INFO [1b05cc09] Running docker run --rm --network kamal --env [REDACTED] --env-file [REDACTED] --volume [REDACTED] my-image sh -c 'ulimit -n' on my-instance
  INFO [1b05cc09] Finished in 0.407 seconds with exit status 0 (successful).
App Host: my-instance
1024 # default value, should be 8192 from the options configured

@9c23a5 9c23a5 marked this pull request as ready for review December 18, 2025 12:34
@djmb djmb merged commit cf6d7b2 into basecamp:main Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants