@@ -1039,6 +1039,8 @@ Status Codes:
10391039
10401040Copy files or folders of container ` id `
10411041
1042+ ** Deprecated** in favor of the ` archive ` endpoint below.
1043+
10421044** Example request** :
10431045
10441046 POST /containers/4fa6e0f0c678/copy HTTP/1.1
@@ -1061,6 +1063,120 @@ Status Codes:
10611063- ** 404** – no such container
10621064- ** 500** – server error
10631065
1066+ ### Retrieving information about files and folders in a container
1067+
1068+ ` HEAD /containers/(id)/archive `
1069+
1070+ See the description of the ` X-Docker-Container-Path-Stat ` header in the
1071+ folowing section.
1072+
1073+ ### Get an archive of a filesystem resource in a container
1074+
1075+ ` GET /containers/(id)/archive `
1076+
1077+ Get an tar archive of a resource in the filesystem of container ` id ` .
1078+
1079+ Query Parameters:
1080+
1081+ - ** path** - resource in the container's filesystem to archive. Required.
1082+
1083+ If not an absolute path, it is relative to the container's root directory.
1084+ The resource specified by ** path** must exist. To assert that the resource
1085+ is expected to be a directory, ** path** should end in ` / ` or ` /. `
1086+ (assuming a path separator of ` / ` ). If ** path** ends in ` /. ` then this
1087+ indicates that only the contents of the ** path** directory should be
1088+ copied. A symlink is always resolved to its target.
1089+
1090+ ** Note** : It is not possible to copy certain system files such as resources
1091+ under ` /proc ` , ` /sys ` , ` /dev ` , and mounts created by the user in the
1092+ container.
1093+
1094+ ** Example request** :
1095+
1096+ GET /containers/8cce319429b2/archive?path=/root HTTP/1.1
1097+
1098+ ** Example response** :
1099+
1100+ HTTP/1.1 200 OK
1101+ Content-Type: application/x-tar
1102+ X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInBhdGgiOiIvcm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oifQ==
1103+
1104+ {{ TAR STREAM }}
1105+
1106+ On success, a response header ` X-Docker-Container-Path-Stat ` will be set to a
1107+ base64-encoded JSON object containing some filesystem header information about
1108+ the archived resource. The above example value would decode to the following
1109+ JSON object (whitespace added for readability):
1110+
1111+ {
1112+ "name": "root",
1113+ "path": "/root",
1114+ "size": 4096,
1115+ "mode": 2147484096,
1116+ "mtime": "2014-02-27T20:51:23Z"
1117+ }
1118+
1119+ A ` HEAD ` request can also be made to this endpoint if only this information is
1120+ desired.
1121+
1122+ Status Codes:
1123+
1124+ - ** 200** - success, returns archive of copied resource
1125+ - ** 400** - client error, bad parameter, details in JSON response body, one of:
1126+ - must specify path parameter (** path** cannot be empty)
1127+ - not a directory (** path** was asserted to be a directory but exists as a
1128+ file)
1129+ - ** 404** - client error, resource not found, one of:
1130+ – no such container (container ` id ` does not exist)
1131+ - no such file or directory (** path** does not exist)
1132+ - ** 500** - server error
1133+
1134+ ### Extract an archive of files or folders to a directory in a container
1135+
1136+ ` PUT /containers/(id)/archive `
1137+
1138+ Upload a tar archive to be extracted to a path in the filesystem of container
1139+ ` id ` .
1140+
1141+ Query Parameters:
1142+
1143+ - ** path** - path to a directory in the container
1144+ to extract the archive's contents into. Required.
1145+
1146+ If not an absolute path, it is relative to the container's root directory.
1147+ The ** path** resource must exist.
1148+ - ** noOverwriteDirNonDir** - If "1", "true", or "True" then it will be an error
1149+ if unpacking the given content would cause an existing directory to be
1150+ replaced with a non-directory and vice versa.
1151+
1152+ ** Example request** :
1153+
1154+ PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
1155+ Content-Type: application/x-tar
1156+
1157+ {{ TAR STREAM }}
1158+
1159+ ** Example response** :
1160+
1161+ HTTP/1.1 200 OK
1162+
1163+ Status Codes:
1164+
1165+ - ** 200** – the content was extracted successfully
1166+ - ** 400** - client error, bad parameter, details in JSON response body, one of:
1167+ - must specify path parameter (** path** cannot be empty)
1168+ - not a directory (** path** should be a directory but exists as a file)
1169+ - unable to overwrite existing directory with non-directory
1170+ (if ** noOverwriteDirNonDir** )
1171+ - unable to overwrite existing non-directory with directory
1172+ (if ** noOverwriteDirNonDir** )
1173+ - ** 403** - client error, permission denied, the volume
1174+ or container rootfs is marked as read-only.
1175+ - ** 404** - client error, resource not found, one of:
1176+ – no such container (container ` id ` does not exist)
1177+ - no such file or directory (** path** resource does not exist)
1178+ - ** 500** – server error
1179+
10641180## 2.2 Images
10651181
10661182### List Images
0 commit comments