mirror of
https://github.com/containers/podman.git
synced 2025-07-03 17:27:18 +08:00
Merge pull request #26463 from shu-kitamura/example_generate-spec
docs: add three examples to podman-generate-spec man page
This commit is contained in:
@ -24,3 +24,147 @@ Output to the given file.
|
||||
#### **--name**, **-n**
|
||||
|
||||
Rename the pod or container, so that it does not conflict with the existing entity. This is helpful when the JSON is to be used before the source pod or container is deleted.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
Generate Specgen JSON based on a container.
|
||||
```
|
||||
$ podman generate spec container1
|
||||
{
|
||||
"name": "container1-clone",
|
||||
"command": [
|
||||
"/bin/sh"
|
||||
],
|
||||
"env": {
|
||||
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||
"container": "podman"
|
||||
},
|
||||
"sdnotifyMode": "container",
|
||||
"pidns": {
|
||||
"nsmode": "default"
|
||||
},
|
||||
"utsns": {
|
||||
"nsmode": "private"
|
||||
},
|
||||
"containerCreateCommand": [
|
||||
"podman",
|
||||
"run",
|
||||
"--name",
|
||||
"container1",
|
||||
"cea2ff433c61"
|
||||
],
|
||||
"init_container_type": "",
|
||||
"image": "cea2ff433c610f5363017404ce989632e12b953114fefc6f597a58e813c15d61",
|
||||
"ipcns": {
|
||||
"nsmode": "default"
|
||||
},
|
||||
"shm_size": 65536000,
|
||||
"shm_size_systemd": 0,
|
||||
"selinux_opts": [
|
||||
"disable"
|
||||
],
|
||||
"userns": {
|
||||
"nsmode": "default"
|
||||
},
|
||||
"idmappings": {
|
||||
"HostUIDMapping": true,
|
||||
"HostGIDMapping": true,
|
||||
"UIDMap": null,
|
||||
"GIDMap": null,
|
||||
"AutoUserNs": false,
|
||||
"AutoUserNsOpts": {
|
||||
"Size": 0,
|
||||
"InitialSize": 0,
|
||||
"PasswdFile": "",
|
||||
"GroupFile": "",
|
||||
"AdditionalUIDMappings": null,
|
||||
"AdditionalGIDMappings": null
|
||||
}
|
||||
},
|
||||
"umask": "0022",
|
||||
"cgroupns": {
|
||||
"nsmode": "default"
|
||||
},
|
||||
"netns": {
|
||||
"nsmode": "slirp4netns"
|
||||
},
|
||||
"Networks": null,
|
||||
"use_image_hosts": false,
|
||||
"resource_limits": {}
|
||||
}
|
||||
```
|
||||
|
||||
Generate Specgen JSON based on a container. The output is single line.
|
||||
```
|
||||
$ podman generate spec --compact container1
|
||||
{"name":"container1-clone","command":["/bin/sh"],...
|
||||
```
|
||||
|
||||
Generate Specgen JSON based on a container, writing the output to the specified file.
|
||||
```
|
||||
$ podman generate spec --filename output.json container1
|
||||
output.json
|
||||
$ cat output.json
|
||||
{
|
||||
"name": "container1-clone",
|
||||
"command": [
|
||||
"/bin/sh"
|
||||
],
|
||||
"env": {
|
||||
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||
"container": "podman"
|
||||
},
|
||||
"sdnotifyMode": "container",
|
||||
"pidns": {
|
||||
"nsmode": "default"
|
||||
},
|
||||
"utsns": {
|
||||
"nsmode": "private"
|
||||
},
|
||||
"containerCreateCommand": [
|
||||
"podman",
|
||||
"run",
|
||||
"--name",
|
||||
"container1",
|
||||
"cea2ff433c61"
|
||||
],
|
||||
"init_container_type": "",
|
||||
"image": "cea2ff433c610f5363017404ce989632e12b953114fefc6f597a58e813c15d61",
|
||||
"ipcns": {
|
||||
"nsmode": "default"
|
||||
},
|
||||
"shm_size": 65536000,
|
||||
"shm_size_systemd": 0,
|
||||
"selinux_opts": [
|
||||
"disable"
|
||||
],
|
||||
"userns": {
|
||||
"nsmode": "default"
|
||||
},
|
||||
"idmappings": {
|
||||
"HostUIDMapping": true,
|
||||
"HostGIDMapping": true,
|
||||
"UIDMap": null,
|
||||
"GIDMap": null,
|
||||
"AutoUserNs": false,
|
||||
"AutoUserNsOpts": {
|
||||
"Size": 0,
|
||||
"InitialSize": 0,
|
||||
"PasswdFile": "",
|
||||
"GroupFile": "",
|
||||
"AdditionalUIDMappings": null,
|
||||
"AdditionalGIDMappings": null
|
||||
}
|
||||
},
|
||||
"umask": "0022",
|
||||
"cgroupns": {
|
||||
"nsmode": "default"
|
||||
},
|
||||
"netns": {
|
||||
"nsmode": "slirp4netns"
|
||||
},
|
||||
"Networks": null,
|
||||
"use_image_hosts": false,
|
||||
"resource_limits": {}
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user