@@ -24,3 +24,147 @@ Output to the given file.
2424#### ** --name** , ** -n**
2525
2626Rename 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.
27+
28+ ## EXAMPLES
29+
30+ Generate Specgen JSON based on a container.
31+ ```
32+ $ podman generate spec container1
33+ {
34+ "name": "container1-clone",
35+ "command": [
36+ "/bin/sh"
37+ ],
38+ "env": {
39+ "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
40+ "container": "podman"
41+ },
42+ "sdnotifyMode": "container",
43+ "pidns": {
44+ "nsmode": "default"
45+ },
46+ "utsns": {
47+ "nsmode": "private"
48+ },
49+ "containerCreateCommand": [
50+ "podman",
51+ "run",
52+ "--name",
53+ "container1",
54+ "cea2ff433c61"
55+ ],
56+ "init_container_type": "",
57+ "image": "cea2ff433c610f5363017404ce989632e12b953114fefc6f597a58e813c15d61",
58+ "ipcns": {
59+ "nsmode": "default"
60+ },
61+ "shm_size": 65536000,
62+ "shm_size_systemd": 0,
63+ "selinux_opts": [
64+ "disable"
65+ ],
66+ "userns": {
67+ "nsmode": "default"
68+ },
69+ "idmappings": {
70+ "HostUIDMapping": true,
71+ "HostGIDMapping": true,
72+ "UIDMap": null,
73+ "GIDMap": null,
74+ "AutoUserNs": false,
75+ "AutoUserNsOpts": {
76+ "Size": 0,
77+ "InitialSize": 0,
78+ "PasswdFile": "",
79+ "GroupFile": "",
80+ "AdditionalUIDMappings": null,
81+ "AdditionalGIDMappings": null
82+ }
83+ },
84+ "umask": "0022",
85+ "cgroupns": {
86+ "nsmode": "default"
87+ },
88+ "netns": {
89+ "nsmode": "slirp4netns"
90+ },
91+ "Networks": null,
92+ "use_image_hosts": false,
93+ "resource_limits": {}
94+ }
95+ ```
96+
97+ Generate Specgen JSON based on a container. The output is single line.
98+ ```
99+ $ podman generate spec --compact container1
100+ {"name":"container1-clone","command":["/bin/sh"],...
101+ ```
102+
103+ Generate Specgen JSON based on a container, writing the output to the specified file.
104+ ```
105+ $ podman generate spec --filename output.json container1
106+ output.json
107+ $ cat output.json
108+ {
109+ "name": "container1-clone",
110+ "command": [
111+ "/bin/sh"
112+ ],
113+ "env": {
114+ "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
115+ "container": "podman"
116+ },
117+ "sdnotifyMode": "container",
118+ "pidns": {
119+ "nsmode": "default"
120+ },
121+ "utsns": {
122+ "nsmode": "private"
123+ },
124+ "containerCreateCommand": [
125+ "podman",
126+ "run",
127+ "--name",
128+ "container1",
129+ "cea2ff433c61"
130+ ],
131+ "init_container_type": "",
132+ "image": "cea2ff433c610f5363017404ce989632e12b953114fefc6f597a58e813c15d61",
133+ "ipcns": {
134+ "nsmode": "default"
135+ },
136+ "shm_size": 65536000,
137+ "shm_size_systemd": 0,
138+ "selinux_opts": [
139+ "disable"
140+ ],
141+ "userns": {
142+ "nsmode": "default"
143+ },
144+ "idmappings": {
145+ "HostUIDMapping": true,
146+ "HostGIDMapping": true,
147+ "UIDMap": null,
148+ "GIDMap": null,
149+ "AutoUserNs": false,
150+ "AutoUserNsOpts": {
151+ "Size": 0,
152+ "InitialSize": 0,
153+ "PasswdFile": "",
154+ "GroupFile": "",
155+ "AdditionalUIDMappings": null,
156+ "AdditionalGIDMappings": null
157+ }
158+ },
159+ "umask": "0022",
160+ "cgroupns": {
161+ "nsmode": "default"
162+ },
163+ "netns": {
164+ "nsmode": "slirp4netns"
165+ },
166+ "Networks": null,
167+ "use_image_hosts": false,
168+ "resource_limits": {}
169+ }
170+ ```
0 commit comments