How to do it...

If you want to use the add-and-drop capability feature, you will need to know how to use it. Here are some common use case examples:

  1. To drop capabilities, run a command similar to the following:
       $ docker container run --cap-drop <CAPABILITY> <image> <command>
  1. Similarly, to add capabilities, run a command similar to the following:
        $ docker container run --cap-add <CAPABILITY> <image> <command>
  1. To remove setuid and setgid capabilities from the container so that it cannot run binaries, which have these bits set, run the following command:
    $ docker container run -it --cap-drop  setuid --cap-drop setgid    alpine ash
  1. To add all the capabilities and just drop sys_admin, run the following command:
    $ docker container run -it --cap-add all --cap-drop sys_admin alpine ash
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.192.212