Skip to content

Conversation

@albers
Copy link
Collaborator

@albers albers commented Sep 12, 2020

- What I did

Several Docker commands have options to create/run a container with special ulimits.
These options take an individual limit as their argument, e.g. nofile=100.
Before this PR, bash completion had no special support for these arguments, treating them as "any string".

See #2712 for the recently added support for ulimits in services.
This change extends the completion part of #2712 and therefore should go into the same Docker release.

- How I did it

Added bash completion for the individual limits after --ulimit|--ulimit-add|ulimit-rm|default-ulimit.

- How to verify it

$ docker service create --ulimit <TAB><TAB>
as=            cpu=           locks=         memlock=       nofile=        rss=           stack=
chroot=        data=          maxlogins=     msgqueue=      nproc=         rtprio=
core=          fsize=         maxsyslogins=  nice=          priority=      sigpending=

$ docker service update --ulimit-add <TAB><TAB>
as=            cpu=           locks=         memlock=       nofile=        rss=           stack=
chroot=        data=          maxlogins=     msgqueue=      nproc=         rtprio=
core=          fsize=         maxsyslogins=  nice=          priority=      sigpending=

$ docker service update --ulimit-rm <TAB><TAB>
as            cpu           locks         memlock       nofile        rss           stack
chroot        data          maxlogins     msgqueue      nproc         rtprio
core          fsize         maxsyslogins  nice          priority      sigpending

$ docker create --ulimit <TAB><TAB>
as=            cpu=           locks=         memlock=       nofile=        rss=           stack=
chroot=        data=          maxlogins=     msgqueue=      nproc=         rtprio=
core=          fsize=         maxsyslogins=  nice=          priority=      sigpending=

$ docker run --ulimit <TAB><TAB>
as=            cpu=           locks=         memlock=       nofile=        rss=           stack=
chroot=        data=          maxlogins=     msgqueue=      nproc=         rtprio=
core=          fsize=         maxsyslogins=  nice=          priority=      sigpending=

$ docker build --ulimit <TAB><TAB>
as=            cpu=           locks=         memlock=       nofile=        rss=           stack=
chroot=        data=          maxlogins=     msgqueue=      nproc=         rtprio=
core=          fsize=         maxsyslogins=  nice=          priority=      sigpending=

$ dockerd --default-ulimit <TAB><TAB>
as=            cpu=           locks=         memlock=       nofile=        rss=           stack=
chroot=        data=          maxlogins=     msgqueue=      nproc=         rtprio=
core=          fsize=         maxsyslogins=  nice=          priority=      sigpending=

- Description for the changelog

Improved bash completion for ulimits

@albers albers requested a review from thaJeztah September 12, 2020 13:52
@albers albers marked this pull request as draft September 12, 2020 13:52
@albers albers changed the title [WIP] Improve bash completion for ulimits Improve bash completion for ulimits Sep 12, 2020
This adds bash completion for limits after

- docker service create --ulimit
- docker service update --ulimit-add
- docker service update --ulimit-rm
- docker container create --ulimit
- docker container run --ulimit
- docker build --ulimit
- dockerd --default-ulimit

Signed-off-by: Harald Albers <github@albersweb.de>
@codecov-commenter
Copy link

Codecov Report

Merging #2714 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #2714   +/-   ##
=======================================
  Coverage   58.59%   58.59%           
=======================================
  Files         296      296           
  Lines       21360    21360           
=======================================
  Hits        12516    12516           
  Misses       7931     7931           
  Partials      913      913           

@albers albers marked this pull request as ready for review September 12, 2020 14:11
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! LGTM thank you!

@thaJeztah
Copy link
Member

@silvin-lubecki PTAL

@thaJeztah thaJeztah added this to the 20.03.0 milestone Sep 14, 2020
Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot @albers 👍

@silvin-lubecki silvin-lubecki merged commit e0eba83 into docker:master Sep 14, 2020
@albers albers deleted the completion-ulimits branch September 15, 2020 18:54
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.

4 participants