Skip to content

Commit

Permalink
Merge 4b2937d into 34f1b9c
Browse files Browse the repository at this point in the history
  • Loading branch information
nexdrew committed May 21, 2020
2 parents 34f1b9c + 4b2937d commit 380f53a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -194,6 +194,9 @@ array.forEach((r) => {
| `HostConfig.UTSMode` | `--uts` |
| `HostConfig.RestartPolicy` | `--restart` |
| `HostConfig.ExtraHosts` | `--add-host` |
| `HostConfig.GroupAdd` | `--group-add` |
| `HostConfig.PidMode` | `--pid` |
| `HostConfig.SecurityOpt` | `--security-opt` |
| `Config.Hostname` | `-h` |
| `Config.Domainname` | `--domainname` |
| `Config.ExposedPorts` | `--expose` |
Expand Down
3 changes: 3 additions & 0 deletions index.js
Expand Up @@ -125,6 +125,9 @@ function toRunCommand (inspectObj, name) {
})
}
if (isCompatible('--add-host', modes)) rc = appendArray(rc, '--add-host', hostcfg.ExtraHosts)
rc = appendArray(rc, '--group-add', hostcfg.GroupAdd)
if (hostcfg.PidMode) rc = append(rc, '--pid', hostcfg.PidMode)
rc = appendArray(rc, '--security-opt', hostcfg.SecurityOpt, quote)

const cfg = inspectObj.Config || {}

Expand Down
21 changes: 18 additions & 3 deletions test/fixtures/inspect-one-two.json
Expand Up @@ -80,11 +80,22 @@
"/project_rrservice_1:/project_service_1/project_rrservice_1"
],
"OomScoreAdj": 0,
"PidMode": "",
"PidMode": "container:9ca8ac5c5b829c5c0a65a290b7c4eb74e9ba36f69344ee11392841fd41d5e3de",
"Privileged": false,
"PublishAllPorts": true,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"SecurityOpt": [
"label=level:s0:c100,c200",
"label=user:USER",
"label=role:ROLE",
"label=type:TYPE",
"label=level:LEVEL",
"label=disable",
"apparmor=docker-default",
"no-new-privileges:true",
"seccomp=unconfined",
"label=type:svirt_apache_t"
],
"UTSMode": "host",
"UsernsMode": "",
"ShmSize": 67108864,
Expand Down Expand Up @@ -273,7 +284,11 @@
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"GroupAdd": [
"audio",
"nogroup",
"777"
],
"IpcMode": "",
"Cgroup": "",
"Links": null,
Expand Down
12 changes: 12 additions & 0 deletions test/test-cli.js
Expand Up @@ -33,6 +33,17 @@ const expectedOneTwo = '\n' +
'--uts host ' +
'--restart on-failure:5 ' +
'--add-host xyz:1.2.3.4 --add-host abc:5.6.7.8 ' +
'--pid container:9ca8ac5c5b829c5c0a65a290b7c4eb74e9ba36f69344ee11392841fd41d5e3de ' +
'--security-opt \'label=level:s0:c100,c200\' ' +
'--security-opt \'label=user:USER\' ' +
'--security-opt \'label=role:ROLE\' ' +
'--security-opt \'label=type:TYPE\' ' +
'--security-opt \'label=level:LEVEL\' ' +
'--security-opt \'label=disable\' ' +
'--security-opt \'apparmor=docker-default\' ' +
'--security-opt \'no-new-privileges:true\' ' +
'--security-opt \'seccomp=unconfined\' ' +
'--security-opt \'label=type:svirt_apache_t\' ' +
'--expose 4700/tcp --expose 4702/tcp ' +
'-l com.docker.compose.config-hash=\'9f94e0df059d6b68fa0e306b9ee555b4fb9d6dbdb3982a0b0f6c7adca2945f26\' ' +
'-l com.docker.compose.container-number=\'1\' ' +
Expand All @@ -55,6 +66,7 @@ const expectedOneTwo = '\n' +
'--runtime nvidia ' +
'--volumes-from admiring_brown --volumes-from silly_jang ' +
'--restart no ' +
'--group-add audio --group-add nogroup --group-add 777 ' +
'-h 46d567b2ef86 ' +
'--domainname rekcod.xyz ' +
'-e \'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\' ' +
Expand Down

0 comments on commit 380f53a

Please sign in to comment.