Update image-layout.md: fix json format in practice#453
Update image-layout.md: fix json format in practice#453vbatts merged 1 commit intoopencontainers:masterfrom Sn0rt:update-image-layout-doc
Conversation
image-layout.md
Outdated
| This is an example image layout: | ||
|
|
||
| ``` | ||
| ```shell |
There was a problem hiding this comment.
This language specification if for the shell language, but the following example is a shell session. It has both shell-language input (which the shell you add formats correctly) and unformatted output (which the shell you add also attempts to format). As an example:
$ echo "in this case, these are not shell keywords"
in this case, these are not shell keywordsI'd rather leave these as language-agnostic blobs to avoid confusion.
There was a problem hiding this comment.
console is the right directive.
@wking I'd recommend at least looking at the github markdown docs before giving direction on a PR.
There was a problem hiding this comment.
I know shell is wrong for shell sessions, because I've made that mistake before myself. Looking at the Linguist docs, they have a separate ShellSession for these:
$ echo "in this case, these are not shell keywords"
in this case, these are not shell keywordsWhich is better than the shell version I posted earlier because the stdout in and case are not highlighted. Linguist is using atom/language-shellscript.
| } | ||
| ``` | ||
| $ cat ./refs/v1.0 | ||
| {"size": 4096, "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f", "mediaType": "application/vnd.oci.image.manifest.list.v1+json"} |
There was a problem hiding this comment.
I'm agnostic about whether we pretty-print JSON output or not, although if we do I prefer jq ;).
There was a problem hiding this comment.
jq is the current json de jour. I agree.
philips
left a comment
There was a problem hiding this comment.
I don't feel strongly on this but jq is the right thing to use in 2016
| } | ||
| ``` | ||
| $ cat ./refs/v1.0 | ||
| {"size": 4096, "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f", "mediaType": "application/vnd.oci.image.manifest.list.v1+json"} |
|
fixed. |
image-layout.md
Outdated
| { | ||
| "size": 4096, | ||
| "digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f", | ||
| "mediaType": "application/vnd.oci.image.manifest.list.v1+json" |
There was a problem hiding this comment.
jq will use two-space indents by default.
image-layout.md
Outdated
| This is an example image layout: | ||
|
|
||
| ``` | ||
| ```shell |
Signed-off-by: Sn0rt <sn0rt@abc.shop.edu.cn>
|
PTAL |
In real world, if you do not format the output of cat, it will be so ugly.
And the original document may generate through imagination.
Example:
[guohao@localhost image-tools]$ cat etcd-oci/ blobs/ oci-layout refs/ [guohao@localhost image-tools]$ cat etcd-oci/refs/latest {"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:99ef9268131c383a83c2845413684a66d391e98560c4a0a9ae923c5f04f79e69","size":1042}[guohao@localhost image-tools]$ cat etcd-oci/blobs/sha256/ 79ac26bcdd8013a398c7b54506d25cd7c738ba061b362fd1ed56cde4d6152a26 99ef9268131c383a83c2845413684a66d391e98560c4a0a9ae923c5f04f79e69 eeee0535bf3cec7a24bff2c6e97481afa3d37e2cdeff277c57cb5cbdb2fa9e92 95e6aab6810eee8381957a8e83ddd76c5dde9d523e7cfda8f172c7b0e3e60c17 a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [guohao@localhost image-tools]$ cat etcd-oci/blobs/sha256/79ac26bcdd8013a398c7b54506d25cd7c738ba061b362fd1ed56cde4d6152a26 {"architecture":"amd64","author":"Dawn Chen \u003cdawnchen@google.com\u003e","config":{"Hostname":"aded96b43f48","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":{"2379/tcp":{},"2380/tcp":{},"4001/tcp":{},"7001/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["sh"],"Image":"3a9a9956eb76a35a3bccaf0b4de38d2ef8262b58cf0df6206fbd1c63f27bfcd3","Volumes":null,"VolumeDriver":"","WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"MacAddress":"","OnBuild":[],"Labels":{}},"container":"78991c8b805f5e57b54e05566640485309acdd6c3292ce23294b08a80e587014","container_config":{"Hostname":"aded96b43f48","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":{"2379/tcp":{},"2380/tcp":{},"4001/tcp":{},"7001/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","#(nop) COPY multi:706b1bbcebb521830420b655a1ea7fe8cfabc2e90d8804a618926df98558efac in /usr/local/bin/"],"Image":"3a9a9956eb76a35a3bccaf0b4de38d2ef8262b58cf0df6206fbd1c63f27bfcd3","Volumes":null,"VolumeDriver":"","WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"MacAddress":"","OnBuild":[],"Labels":{}},"created":"2016-08-10T06:33:47.01604452Z","docker_version":"1.7.1","history":[{"created":"2016-01-15T18:06:40.707908287Z","created_by":"/bin/sh -c #(nop) ADD file:a62b361be92f978752150570261ddc6fc21b025e3a28418820a1f39b7db7498c in /"},{"created":"2016-01-15T18:06:41.282540103Z","created_by":"/bin/sh -c #(nop) CMD [\"sh\"]"},{"created":"2016-07-21T06:14:20.151595901Z","author":"Dawn Chen \u003cdawnchen@google.com\u003e","created_by":"/bin/sh -c #(nop) MAINTAINER Dawn Chen \u003cdawnchen@google.com\u003e"},{"created":"2016-07-21T06:14:20.629667506Z","author":"Dawn Chen \u003cdawnchen@google.com\u003e","created_by":"/bin/sh -c #(nop) EXPOSE 2379/tcp 2380/tcp 4001/tcp 7001/tcp"},{"created":"2016-08-10T06:33:47.01604452Z","author":"Dawn Chen \u003cdawnchen@google.com\u003e","created_by":"/bin/sh -c #(nop) COPY multi:706b1bbcebb521830420b655a1ea7fe8cfabc2e90d8804a618926df98558efac in /usr/local/bin/"}],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:2c84284818d186d88a16ac7fa731d4b71ba69ecfe11b4ce00413366833cb2403","sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef","sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef","sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef","sha256:5e47621858b3629202b1db1e24abbe4046124c002bbe943bc7ff6502933146c4"]}}[guohao@localhost image-tools]$ uname -a Linux localhost.localdomain 4.7.2-201.fc24.x86_64 #1 SMP Fri Aug 26 15:58:40 UTC 2016 x86_64 x86_64 x86_64 GNU/LinuxFormated:
Signed-off-by: Sn0rt Sn0rt@abc.shop.edu.cn