真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

怎么給容器添加linuxCapabilities

這篇文章主要講解了“怎么給容器添加linux Capabilities”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“怎么給容器添加linux Capabilities”吧!

創(chuàng)新互聯(lián)建站是一家專(zhuān)注于成都做網(wǎng)站、成都網(wǎng)站設(shè)計(jì)與策劃設(shè)計(jì),遼中網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)建站做網(wǎng)站,專(zhuān)注于網(wǎng)站建設(shè)十年,網(wǎng)設(shè)計(jì)領(lǐng)域的專(zhuān)業(yè)建站公司;建站業(yè)務(wù)涵蓋:遼中等地區(qū)。遼中做網(wǎng)站價(jià)格咨詢(xún):13518219792

Docker Container Capabilities

在docker run命令中,我們可以通過(guò)--cap-add--cap-drop來(lái)給容器添加linux Capabilities。下面表格中的列出的Capabilities是docker默認(rèn)給容器添加的,用戶(hù)可以通過(guò)--cap-drop去除其中一個(gè)或者多個(gè)。

Docker’s capabilitiesLinux capabilitiesCapability Description
SETPCAPCAP_SETPCAPModify process capabilities.
MKNODCAP_MKNODCreate special files using mknod(2).
AUDIT_WRITECAP_AUDIT_WRITEWrite records to kernel auditing log.
CHOWNCAP_CHOWNMake arbitrary changes to file UIDs and GIDs (see chown(2)).
NET_RAWCAP_NET_RAWUse RAW and PACKET sockets.
DAC_OVERRIDECAP_DAC_OVERRIDEBypass file read, write, and execute permission checks.
FOWNERCAP_FOWNERBypass permission checks on operations that normally require the file system UID of the process to match the UID of the file.
FSETIDCAP_FSETIDDon’t clear set-user-ID and set-group-ID permission bits when a file is modified.
KILLCAP_KILLBypass permission checks for sending signals.
SETGIDCAP_SETGIDMake arbitrary manipulations of process GIDs and supplementary GID list.
SETUIDCAP_SETUIDMake arbitrary manipulations of process UIDs.
NET_BIND_SERVICECAP_NET_BIND_SERVICEBind a socket to internet domain privileged ports (port numbers less than 1024).
SYS_CHROOTCAP_SYS_CHROOTUse chroot(2), change root directory.
SETFCAPCAP_SETFCAPSet file capabilities.

下面表格中列出的Capabilities是docker默認(rèn)刪除的Capabilities,用戶(hù)可以通過(guò)--cap-add添加其中一個(gè)或者多個(gè)。

Docker’s capabilitiesLinux capabilitiesCapability Description
SYS_MODULECAP_SYS_MODULELoad and unload kernel modules.
SYS_RAWIOCAP_SYS_RAWIOPerform I/O port operations (iopl(2) and ioperm(2)).
SYS_PACCTCAP_SYS_PACCTUse acct(2), switch process accounting on or off.
SYS_ADMINCAP_SYS_ADMINPerform a range of system administration operations.
SYS_NICECAP_SYS_NICERaise process nice value (nice(2), setpriority(2)) and change the nice value for arbitrary processes.
SYS_RESOURCECAP_SYS_RESOURCEOverride resource Limits.
SYS_TIMECAP_SYS_TIMESet system clock (settimeofday(2), stime(2), adjtimex(2)); set real-time (hardware) clock.
SYS_TTY_CONFIGCAP_SYS_TTY_CONFIGUse vhangup(2); employ various privileged ioctl(2) operations on virtual terminals.
AUDIT_CONTROLCAP_AUDIT_CONTROLEnable and disable kernel auditing; change auditing filter rules; retrieve auditing status and filtering rules.
MAC_OVERRIDECAP_MAC_OVERRIDEAllow MAC configuration or state changes. Implemented for the Smack LSM.
MAC_ADMINCAP_MAC_ADMINOverride Mandatory Access Control (MAC). Implemented for the Smack Linux Security Module (LSM).
NET_ADMINCAP_NET_ADMINPerform various network-related operations.
SYSLOGCAP_SYSLOGPerform privileged syslog(2) operations.
DAC_READ_SEARCHCAP_DAC_READ_SEARCHBypass file read permission checks and directory read and execute permission checks.
LINUX_IMMUTABLECAP_LINUX_IMMUTABLESet the FS_APPEND_FL and FS_IMMUTABLE_FL i-node flags.
NET_BROADCASTCAP_NET_BROADCASTMake socket broadcasts, and listen to multicasts.
IPC_LOCKCAP_IPC_LOCKLock memory (mlock(2), mlockall(2), mmap(2), shmctl(2)).
IPC_OWNERCAP_IPC_OWNERBypass permission checks for operations on System V IPC objects.
SYS_PTRACECAP_SYS_PTRACETrace arbitrary processes using ptrace(2).
SYS_BOOTCAP_SYS_BOOTUse reboot(2) and kexec_load(2), reboot and load a new kernel for later execution.
LEASECAP_LEASEEstablish leases on arbitrary files (see fcntl(2)).
WAKE_ALARMCAP_WAKE_ALARMTrigger something that will wake up the system.
BLOCK_SUSPENDCAP_BLOCK_SUSPENDEmploy features that can block system suspend.

比如,我們可以通過(guò)給給容器add NET_ADMIN Capability,使得我們可以對(duì)network interface進(jìn)行modify,對(duì)應(yīng)的docker run命令如下:

$ docker run -it --rm --cap-add=NET_ADMIN ubuntu:14.04 ip link add dummy0 type dummy

Kubernetes SecurityContext

在Kubernetes對(duì)Pod的定義中,用戶(hù)可以add/drop Capabilities在Pod.spec.containers.sercurityContext.capabilities中添加要add的Capabilities list和drop的Capabilities list。

比如,我要添加NET_ADMIN Capability,刪除KILL Capability,則對(duì)應(yīng)的Pod定義如下:

apiVersion: v1
kind: Pod
metadata:
  name: hello-world
spec:
  containers:
  - name: friendly-container
    image: "alpine:3.4"
    command: ["/bin/echo", "hello", "world"]
    securityContext:
      capabilities:
        add:
        - NET_ADMIN
        drop:
        - KILL

感謝各位的閱讀,以上就是“怎么給容器添加linux Capabilities”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)怎么給容器添加linux Capabilities這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!


網(wǎng)站欄目:怎么給容器添加linuxCapabilities
當(dāng)前鏈接:http://weahome.cn/article/ijeghg.html

其他資訊

在線(xiàn)咨詢(xún)

微信咨詢(xún)

電話(huà)咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部