Commit graph

305 commits

Author SHA1 Message Date
Daniel Nephin
7abeb08a8c Wrap errors in digest package so they are consistent between platforms.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-08 11:48:46 -05:00
Daniel Nephin
69d7362058 Use assertions in image package unit tests.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-08 11:46:10 -05:00
Antonio Murdaca
1cf4b2b8bd
image/cache: fix isValidParent logic
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-02-21 19:32:04 +01:00
Derek McGowan
3a1279393f
Use distribution reference
Remove forked reference package. Use normalized named values
everywhere and familiar functions to convert back to familiar
strings for UX and storage compatibility.

Enforce that the source repository in the distribution metadata
is always a normalized string, ignore invalid values which are not.
Update distribution tests to use normalized values.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-07 11:08:37 -08:00
Xinbo Weng
5b258f6ac2
some grammatical errors
Signed-off-by: Xinbo Weng <xihuanbo_0521@zju.edu.cn>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-01-31 19:33:12 -08:00
Alexander Morozov
df5d909ac9 Merge pull request #29851 from vdemeester/daemon-extract-image-cache
Extract the daemon image cache to its own package
2017-01-26 10:50:35 -08:00
Alexander Morozov
effc91e7a5 Merge pull request #29830 from timthelion/issue29821
Docs: Be more clear when specifying valid formats for strings
2017-01-26 10:45:03 -08:00
Lei Jitang
ee5228e799 Follow #28926, fix docker save can't share layers in the tar archive.
After https://github.com/docker/docker/pull/28926, if saving multiple images
which have common layers at same time, the common layers can't share in the tar archive
because the hash ID changes because of the Create time. The Create time is used for
pre v1.9 which treat each layer as a image and make no sense for after v1.10.
To make the hash ID consistent and keep the image save from >1.10 working properly
on pre v1.9, using a constant Create time `time.Unix(0,0)`.

Signed-off-by: Lei Jitang <leijitang@huawei.com>
2017-01-17 05:40:59 -05:00
Antonio Murdaca
675f4140e7
image: tarexport: do not quote integers in format string
Basically, prevents outputs like:
```
invalid manifest, layers length mismatch: expected '\x02', got '\x01'
```

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-01-14 20:03:11 +01:00
Stephen J Day
7a85579917
*: use opencontainers/go-digest package
The `digest` data type, used throughout docker for image verification
and identity, has been broken out into `opencontainers/go-digest`. This
PR updates the dependencies and moves uses over to the new type.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-01-06 18:48:41 -08:00
Timothy Hobbs
b71b4e1fb9 Docs: Be more clear when specifying valid formats for strings
- Use the word letter rather than character to refer to letters ;) when trying to specify that only letters and numbers can be used, and not ANY character...
- Small corrections

Fixes #29821

Signed-off-by: Timothy Hobbs <timothy@hobbs.cz>
2017-01-03 21:40:50 +01:00
Vincent Demeester
be1df1ee13
Extract the daemon image cache to its own package
ImageCache is now independent of `Daemon` and is located in
`image/cache` package.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-01-03 19:19:27 +01:00
Tonis Tiigi
9f3046f9a0 Move imageID validation to stringid pkg
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-12-26 18:53:22 -08:00
Vincent Demeester
ba1c20f8d6 Merge pull request #29345 from yuexiao-wang/fix-err-info
Fix incorrect words and formats in image
2016-12-21 21:50:11 +01:00
allencloud
7c3657065c change minor mistake of spelling
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-12-20 21:05:19 +08:00
yuexiao-wang
b2ec509a3f Fix incorrect info and format of error in image
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2016-12-20 18:20:15 +08:00
unclejack
2c187a24e0 return directly without ifs in remaining packages
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2016-12-14 23:28:27 +02:00
Tõnis Tiigi
dd20fa60b4 Merge pull request #28926 from coolljt0725/fix_save
Fix docker save with empty timestamp of layer created time
2016-11-30 11:23:19 -08:00
Stephen J Day
8616b0690a
tarexport: check symlink error when saving layer
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2016-11-29 13:08:24 -08:00
Lei Jitang
e0b2c0af4d Fix docker save with empty timestamp of layer created time
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-11-29 03:58:23 -05:00
John Howard
7c29f5beed Windows: Use sequential file access
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-11-14 17:41:52 -08:00
Qiang Huang
e6866492c4 Fix bunch of typos
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-10-29 15:03:26 +08:00
Tonis Tiigi
805223982c Generalize content addressable and reference storage
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-09-15 18:08:19 -07:00
Tõnis Tiigi
b890d475f7 Merge pull request #25806 from Microsoft/jjh-missingdigest
Don't fail daemon start on missing layer
2016-09-07 16:35:27 -07:00
John Howard
540c8e9b20 Windows: Skip layers+base images
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-07 12:16:45 -07:00
Michael Crosby
91e197d614 Add engine-api types to docker
This moves the types for the `engine-api` repo to the existing types
package.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-09-07 11:05:58 -07:00
Wenkai Yin
8f37abd056 fixes #25654
Signed-off-by: Wenkai Yin <yinw@vmware.com>
2016-08-31 15:37:52 +08:00
Thomas Leonard
9841cfe4c9 Document Healthcheck in image spec
Signed-off-by: Thomas Leonard <thomas.leonard@docker.com>
2016-08-18 15:53:22 +01:00
Vincent Demeester
353af0b3ec Merge pull request #25557 from yongtang/25529-image-load-api
Return `application/json` for image/load API (quiet=1)
2016-08-12 11:07:43 +02:00
Yong Tang
2f27632cde Return application/json for image/load API (quite=1)
This fix tries to address the issue raised in 25529 wehre the
image/load API returns `application/json` for quiet=0 and
`text/plain` for quite=1.

This fix makes the change so that `application/json` is returned
for both quiet=0 and quite=1.

This fix has been tested manually.

This fix fixes 25529.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-08-09 17:55:42 -07:00
allencloud
0ead624473 add defer file.Close to avoid potential fd leak
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-08-10 08:36:09 +08:00
Stefan J. Wernli
f342b27145 Removing old custom RootFS behavior on Windows.
Windows base layers are no longer the special "layers+base" type, so we can remove all the special handling for that.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
2016-07-29 14:15:59 -07:00
Derek McGowan
5487881e12 Fix calculation of relative path for symlink on docker save
Relative paths are now calculated from a base path rather than from the file path, which gets treated like a directory.
Symlinks will now properly point to the file as "../<layer dir>/layer.tar" rather the incorrect "../../<layer dir>/layer.tar".

Fixes #24951

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-07-25 13:28:10 -07:00
Aaron Lehmann
2f19e910bd image spec: Correct set of acceptable characters in tags
The image spec did not match the regexp that validates tags. It
neglected to mention that period and dash characters are allowed in
tags, as long as they are not the first character. It also did not
mention the length limit for tags.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-07-05 10:02:16 -07:00
Otto Kekäläinen
644a7426cc Fix spelling in comments, strings and documentation
Signed-off-by: Otto Kekäläinen <otto@seravo.fi>
2016-07-03 20:58:11 +03:00
Alexander Morozov
9809446060 Merge pull request #24003 from tonistiigi/fix-duplicate-layers
Fix duplicate layers in exported tar
2016-06-30 17:07:58 -07:00
Tonis Tiigi
41bf7de73b Fix duplicate layers in exported tar
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-06-29 18:06:42 -07:00
John Starks
5fd8edec1c Report load progress on compressed layer size
When calling docker load on an image tar containing a compressed layer,
apply NewProgressReader to the compressed layer (whose size is known), not
the uncompressed stream. This fixes progress reporting to the client in
this case.

Signed-off-by: John Starks <jostarks@microsoft.com>
2016-06-24 15:28:26 -07:00
Doug Davis
6986a3220f Say something useful during docker load
During a `docker load` there are times when nothing is printed
to the screen, leaving the user with no idea whether something happened.
When something *is* printed, often its just something like:
```
1834950e52ce: Loading layer 1.311 MB/1.311 MB
5f70bf18a086: Loading layer 1.024 kB/1.024 kB
```
which isn't necessarily the same as the image IDs.

This PR will either show:
- all of the tags for the image, or
- all of the image IDs if there are no tags

Sample output:
```
$ docker load -i busybox.tar
Loaded image: busybox:latest

$ docker load -i a.tar
Loaded image ID: sha256:47bcc53f74dc94b1920f0b34f6036096526296767650f223433fe65c35f149eb
```

IOW, show the human-friendly stuff first and then only if there are no tags
default back to the image IDs, so they have something to work with.

For me this this is needed because I have lots of images and after a
recent `docker load` I had no idea what image I just imported and had a
hard time figuring it out.  This should fix that by telling the user
which images they just imported.

I'll add tests once there's agreement that we want this change.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-06-08 17:17:05 +02:00
Derek McGowan
2c60430a3d Use describable interfaces
Replace use of foreign sources with descriptors and describable

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-06-06 17:49:34 -07:00
Arnaud Porterie
7d08f3a5ad Merge pull request #22866 from jstarks/foreign_layers
Support layers from external URLs
2016-06-07 00:27:40 +00:00
John Starks
05bd04350b Support layers from external URLs
This is used to support downloading Windows base images from Microsoft
servers.

Signed-off-by: John Starks <jostarks@microsoft.com>
2016-05-25 19:23:02 -07:00
Sebastiaan van Stijn
7faa2a40bc Merge pull request #22264 from aaronlehmann/updated-image-spec
Update image specification for content-addressability changes
2016-05-24 18:06:52 +02:00
Aaron Lehmann
4fa0eccd10 Update image specification for content-addressability changes
The image spec in image/spec/v1.md is quite a bit out of date. Not only
is it missing the changes that went into 1.10 for content
addressability, but it has inaccuracies that date back further, such as
mentioning storing tarsum in the image configuration.

This commit creates image/spec/v1.1.md which brings the specification up
to date. It discusses content addressability, new fields in the image
configuration, the repository/tag grammar, and the current mechanism for
exporting an image.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-05-12 11:12:34 -07:00
Alexander Morozov
a2eacff5c7 image/tarexport: fix error formatting
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-05-02 10:26:32 -07:00
Kai Qiang Wu(Kennan)
0656105710 Add load/save image event support
For every docker load and save operations, it would log related
image events.

Signed-off-by: Kai Qiang Wu(Kennan) <wkqwu@cn.ibm.com>
2016-04-27 01:11:03 +00:00
Tonis Tiigi
ea3cbd3274 Safer file io for configuration files
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-04-21 11:31:15 -07:00
Vincent Demeester
7534f17261
Update code for latest engine-api
- Update CopyToContainer uses
- Use engine-api/types/versions instead of pkg/version

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-04-19 16:56:54 +02:00
Akihiro Suda
d231260868 Clean up unused code
Signed-off-by: Akihiro Suda <suda.kyoto@gmail.com>
2016-04-14 07:04:10 +00:00
Lei Jitang
96d7db665b Fix docker load progressbar, fixes #21957
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-04-12 22:45:42 -04:00
Sebastiaan van Stijn
3f39035f18 Merge pull request #21819 from tophj-ibm/fix-ensure-emptyfs-other-architectures
Fix .ensure-emptyfs on non-x86_64 architectures
2016-04-09 13:40:45 -07:00
Christopher Jones
1f59bc8c03 Fix .ensure-emptyfs on non-x86_64 architectures
Now that we are checking if the image and host have the same architectures
via #21272, this value should be null so that the test passes on non-x86
machines

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
2016-04-08 17:38:13 -04:00
John Starks
d45a26d7e2 Windows: Support non-base-layered images
Previously, Windows only supported running with a OS-managed base image.
With this change, Windows supports normal, Linux-like layered images, too.

Signed-off-by: John Starks <jostarks@microsoft.com>
2016-04-07 17:52:26 -07:00
John Starks
194eaa5c0f Add os_version and os_features to Image
These fields are needed to specify the exact version of Windows that an
image can run on. They may be useful for other platforms in the future.

This also changes image.store.Create to validate that the loaded image is
supported on the current machine. This change affects Linux as well, since
it now validates the architecture and OS fields.

Signed-off-by: John Starks <jostarks@microsoft.com>
2016-04-04 13:14:57 -07:00
Tonis Tiigi
faeff5118f Add parent references support to load/save
Restores the correct parent chain relationship
between images on docker load if multiple images
have been saved.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-03-21 19:31:10 -07:00
David Calavera
df20b5cfd3 Merge pull request #21002 from tonistiigi/fix-id-noprefix
Fix docker run for 64 byte hex ID
2016-03-14 10:17:38 -07:00
Tonis Tiigi
16e4c4e481 Fix docker run for 64 byte hex ID
Fixes #20972

Also makes sure there is no check to registry if
no image is found for the prefixed IDs.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-03-11 10:02:47 -08:00
allencloud
bbeb859b64 fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-03-11 23:22:16 +08:00
Kai Qiang Wu(Kennan)
ed231d4095 Refine error message when save non-exist image
Fixes: #20709
As discussed in the issue, we need refine the message to
help user more understood, what happened for non-exist image.

Signed-off-by: Kai Qiang Wu(Kennan) <wkqwu@cn.ibm.com>
2016-03-08 01:45:19 +00:00
Qiang Huang
53b0d62683 Vendor engine-api to 70d266e96080e3c3d63c55a4d8659e00ac1f7e6c
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-02-29 19:28:37 +08:00
Vincent Demeester
61d24e769d Merge pull request #20572 from runcom/sudo-user
resolve the config file from the sudo user
2016-02-25 16:05:25 +01:00
Antonio Murdaca
afde6450ee resolve the config file from the sudo user
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-02-24 15:41:00 +01:00
Stefan Weil
2eee613326 Fix some typos in comments and strings
Most of them were found and fixed by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-02-22 20:27:15 +01:00
Victor Vieux
99a396902f fix common misspell
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-02-11 15:49:36 -08:00
Stefan J. Wernli
041a9510c6 Fixing 'docker save' on Windows.
Save was failing file integrity checksums due to bugs in both
Windows and Docker. This commit includes fixes to file time handling
in tarexport and system.chtimes that are necessary along with
the Windows platform fixes to correctly support save. With this
change, sysfile_backups for windowsfilter driver are no longer
needed, so that code is removed.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
2016-02-08 18:08:49 -08:00
Alexander Morozov
415dd86886 Merge pull request #20078 from cpuguy83/carry_17329
Carry 17329
2016-02-07 08:59:36 -08:00
Brian Goff
e9ab596238 carry 17329
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-06 13:46:21 -05:00
Tonis Tiigi
4852932494 Clear old parent reference on resetting image parent
On migration 2 different images can end up with same
content addressable ID, meaning `SetParent` will be called
multiple times. Previous version did not clear the old
in-memory reference.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-02-05 17:05:19 -08:00
Lei Jitang
fae09e2569 Add progress bar to docker load
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-02-05 02:24:23 -05:00
Anusha Ragunathan
9c332b164f Remove package daemonbuilder.
Currently, daemonbuilder package (part of daemon) implemented the
builder backend. However, it was a very thin wrapper around daemon
methods and caused an implementation dependency for api/server build
endpoint. api/server buildrouter should only know about the backend
implementing the /build API endpoint.

Removing daemonbuilder involved moving build specific methods to
respective files in the daemon, where they fit naturally.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-02-01 09:57:38 -08:00
Aaron Lehmann
c168a0059f Update code to compile against new manifest interface
Also, digest.FromBytes no longer returns an error.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-01-08 17:24:20 -08:00
David Calavera
907407d0b2 Modify import paths to point to the new engine-api package.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-06 19:48:59 -05:00
David Calavera
7ac4232e70 Move Config and HostConfig from runconfig to types/container.
- Make the API client library completely standalone.
- Move windows partition isolation detection to the client, so the
  driver doesn't use external types.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-22 13:34:30 -05:00
David Calavera
6ee7c94263 Merge pull request #18727 from tonistiigi/partial-load
Add support for partial load
2015-12-18 11:10:55 -08:00
Tonis Tiigi
f946782316 Add support for partial load
Missing layers in tar will not cause an error if 
layers are already loaded before.

Fixes #18723

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-12-16 13:46:40 -08:00
Tonis Tiigi
eeb2d4c1ad Clean up reference type switches
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-12-16 11:58:53 -08:00
Tonis Tiigi
ffded61dad Update Named reference with validation of conversions
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-12-16 11:58:52 -08:00
Tonis Tiigi
2655954c2d Add own reference package wrapper
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-12-16 11:58:52 -08:00
Justas Brazauskas
927b334ebf Fix typos found across repository
Signed-off-by: Justas Brazauskas <brazauskasjustas@gmail.com>
2015-12-13 18:04:12 +02:00
Tonis Tiigi
fcb083c6ac Fix image deletion conflicts with search
Removed images were not cleaned up from the
digest-set that is used for the search index.

Fixes #18437

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-12-04 13:15:54 -08:00
Vincent Batts
a26accfb5d Merge pull request #18226 from duglin/Issue18170
Fix for zero-sized layers
2015-11-30 09:57:37 -06:00
Brian Goff
9ebf7dfae3 Merge pull request #18252 from aaronlehmann/tarstream-readcloser
Make TarStream return an io.ReadCloser
2015-11-25 21:35:21 -05:00
Doug Davis
7bb9fc415a Fix for zero-sized layers
Moved a defer up to a better spot.

Fixed TestUntarPathWithInvalidDest to actually fail for the right reason

Closes #18170

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-11-25 18:02:03 -08:00
Aaron Lehmann
21278efaee Make TarStream return an io.ReadCloser
Currently, the resources associated with the io.Reader returned by
TarStream are only freed when it is read until EOF. This means that
partial uploads or exports (for example, in the case of a full disk or
severed connection) can leak a goroutine and open file. This commit
changes TarStream to return an io.ReadCloser. Resources are freed when
Close is called.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-11-25 16:39:54 -08:00
Tonis Tiigi
20e759ab56 Validate adding digests to tagstore with go types
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-11-25 15:06:51 -08:00
Tonis Tiigi
01ba0a935b Add image store
The image store abstracts image handling. It keeps track of the
available images, and makes it possible to delete existing images or
register new ones. The image store holds references to the underlying
layers for each image.

The image/v1 package provides compatibility functions for interoperating
with older (non-content-addressable) image structures.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-11-24 09:40:24 -08:00
David Calavera
3a1200f9f1 Revert "Tidy config/hostconfig structures"
This reverts commit ad5052df23.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-11-09 15:46:45 -05:00
John Howard
ad5052df23 Tidy config/hostconfig structures
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-11-06 17:53:46 -08:00
John Howard
a7e686a779 Windows: Add volume support
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-10-22 10:42:53 -07:00
Tonis Tiigi
504e67b867 Calculate hash based image IDs on pull
Generate a hash chain involving the image configuration, layer digests,
and parent image hashes. Use the digests to compute IDs for each image
in a manifest, instead of using the remotely specified IDs.

To avoid breaking users' caches, check for images already in the graph
under old IDs, and avoid repulling an image if the version on disk under
the legacy ID ends up with the same digest that was computed from the
manifest for that image.

When a calculated ID already exists in the graph but can't be verified,
continue trying SHA256(digest) until a suitable ID is found.

"save" and "load" are not changed to use a similar scheme. "load" will
preserve the IDs present in the tar file.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-10-12 10:51:28 -07:00
Srini Brahmaroutu
da0ca83377 Adding error codes to image package
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2015-09-23 17:03:37 +00:00
root
b061572916 /image - fix lint errors/warnings
Addresses #14756
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2015-07-27 05:40:57 +00:00
John Howard
9001ea26e7 Fixing Image struct to no longer use Graph.
Signed-off-by:  John Howard <jhoward@microsoft.com>
2015-07-20 13:59:53 -07:00
John Howard
52f4d09ffb Windows: Graph driver implementation
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-07-10 14:33:11 -07:00
Mary Anthony
cd44018856 Carry of PR #13520
Removinig files

Signed-off-by: Mary Anthony <mary@docker.com>
2015-06-13 09:27:30 -07:00
Derek McGowan
2b58b677a5 Separate graph from image
Move graph related functions in image to graph package.
Consolidating graph functionality is the first step in refactoring graph into an image store model.
Subsequent refactors will involve breaking up graph into multiple types with a strongly defined interface.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-06-05 18:06:09 -07:00
Joe Gordon
3d87b80b46 Fix spelling mistakes in documentation
While reading  some of the docs I noticed a few errors, so I ran
misspellings (https://pypi.python.org/pypi/misspellings) on markdown files

Signed-off-by: Joe Gordon <joe.gordon0@gmail.com>
2015-05-31 11:53:23 -07:00
unclejack
8f57e7d2ef image: precompile regexp
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2015-05-13 21:47:43 +03:00
John Howard
1c3b697d60 Windows: Fix filepath vs path in image.go
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-05-04 16:23:17 -07:00
Antonio Murdaca
844538142d Small if err cleaning
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-27 21:50:33 +02:00
Tomas Tomecek
d6c839cf0f v1 spec: fix typos and formatting
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2015-04-23 08:19:52 +02:00
Antonio Murdaca
c30a55f14d Refactor utils/utils, fixes #11923
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-14 01:37:36 +02:00
Mabin
d5ea4bae4a when the file that was opened has been read into buffer, the file should be close.
Signed-off-by: Mabin <bin.ma@huawei.com>
2015-02-27 19:09:17 +08:00
Josh Hawn
3414307306 Remove Checksum field from image.Image struct
The checksum is now being stored in a separate file beside the image
JSON file.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-01-30 09:37:50 -08:00
Derek McGowan
e9f6f1a930 Store tar checksum in separate file
Fixes #10432

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-01-29 21:28:20 -08:00
Josh Hawn
e636df8d96 No longer compute checksum when installing images.
While checksums are verified when a layer is pulled from v2 registries,
there are known issues where the checksum may change when the layer diff
is computed again. To avoid these issues, the checksum should no longer
be computed and stored until after it has been extracted to the docker
storage driver. The checksums are instead computed lazily before they
are pushed to a v2 registry.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-01-29 13:52:59 -08:00
Arnaud Porterie
bfa0dc47da Merge pull request #10305 from jlhawn/use_tarsum_v1
Always store images with tarsum.v1 checksum added
2015-01-26 14:42:07 -08:00
James Turnbull
283597ad37 Merge pull request #10333 from jlhawn/image_json_schema_reword
Updated image spec docs to clarify image JSON
2015-01-26 07:49:44 -05:00
Josh Hawn
71763636f2 Updated image spec docs to clarify image JSON
The title `Image JSON Schema` was used as a header in the section
which describes the layout and fields of the image metadata JSON
file. It was pointed out that `JSON Schema` is its own term for
describing JSON in a machine-and-human-readable format, while the
word "Schema" in this context was used more generically to say that
the section is meant to be an example and outline of the Image JSON.

http://spacetelescope.github.io/understanding-json-schema/

This section now has the title `Image JSON Description` in order
to not cause this confusion.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-01-24 10:21:11 -08:00
Jessica Frazelle
c49cd3d2a5 Make debugs logs suck less.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2015-01-23 13:20:29 -08:00
Josh Hawn
ba3bad66f9 Always store images with tarsum.v1 checksum added
Updates `image.StoreImage()` to always ensure that images
that are installed in Docker have a tarsum.v1 checksum.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-01-23 11:30:27 -08:00
Josh Hawn
213e3d1166 Add Tarsum Calculation during v2 Pull operation
While the v2 pull operation is writing the body of the layer blob to disk
it now computes the tarsum checksum of the archive before extracting it to
the backend storage driver. If the checksum does not match that from the
image manifest an error is raised.

Also adds more debug logging to the pull operation and fixes existing test
cases which were failing. Adds a reverse lookup constructor to the tarsum
package so that you can get a tarsum object using a checksum label.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-01-15 14:05:05 -08:00
Ankush Agarwal
82bfb3852e Typo creating -> created
Signed-off-by: Ankush Agarwal <ankushagarwal11@gmail.com>
2015-01-14 23:02:17 -08:00
Ankush Agarwal
034466d356 Typo image -> container
Signed-off-by: Ankush Agarwal <ankushagarwal11@gmail.com>
2015-01-14 17:18:11 -08:00
Josh Hawn
79910625f0 Adds Docker Image v1 Spec Documention
Many iterations have gone into documenting a v1 specification of Docker's Image
format.

v1 Image spec: clarify parent field

- metalivedev pointed out that the description was ambiguous, so I've removed
  mention that it was randomly generated. It IS the ID of the parent image.

Updated v1 image specificatino documentation

- More complete details and deprication notifications for each field
  in the JSON metadata of an image.
- Details on the format for packaging combined Image JSON + Filesystem
  Changeset archives for all layers of an image.

Clarify description of an image "Layer" in v1 spec

Updated intro of image v1 spec

Updated image v1 spec after more review

- Removed description of "Image" from the terminology section. The entire
  document is meant to serve this purpose.
- Updated the definition of "Image Filesystem Changeset".
- Clarified the level of randomness needed for generating image IDs.
- Updated the description of "Image Checksum".
- Added term descriptions for "Repository" and "Tag"
- Removed extraneous/implementation-specific fields from the Image JSON
  example file and field descriptions:
  - removed "container_config" and "docker_version" fields.
  - Added missing "author" field example and description.
- Removed extraneous/implementation-specific fields from the "config" struct
  example and description:
  - removed "Hostname", "Domainname", "Cpuset", "AttachStdin", "AttachStdout",
    "AttachStderr", "PortSpecs", "Tty", "OpenStdin", "StdinOnce", "Image",
    "NetworkDisabled", and "OnBuild".
- Updated example Image JSON config with better example values for "Env",
  "Cmd", "Volumes", "WorkingDir", "Entrypoint", "CpuShares", "Memory",
  "MemorySwap", and "User".
- Added notices that any fields not specified are to be considered as
  implementation specific and should be ignored my implementations which
  are unable to interpret them.
- Updated example of creating layer filesystem changesets to use less formal
  language.
- Listed more details in the section regarding extraction of a bundle of image
  layers into the root filesystem of a container.
- Updated the closing mention of Docker as an evolving implementation.

More updates to the v1 image spec

- Added line wrapping after 80 columns per line to adhere to documentation
  style guides, as pointed out by @jamtur01

- Removed references to any specific docker commands, updated a few descriptions
  or drop repeated statements, as pointed out by @cpuguy83

Cleanup image v1 spec draft after fredlf comments

Address comments by mmdriley on v1 image spec

Improve description of image v1 spec 'config.User`

- Improves description of image v1 specification for the 'User' runtime
  parameter after recomendations by tianon.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-01-12 10:37:46 -08:00
Tonis Tiigi
6705477673 Fix misuses of format based logging functions
Signed-off-by: Tõnis Tiigi <tonistiigi@gmail.com> (github: tonistiigi)
2014-11-19 23:59:02 +02:00
Michael Crosby
039aa2741f Merge pull request #8964 from jlhawn/image_checksum
Compute TarSum on storage of image layer content
2014-11-13 18:07:20 -08:00
Recursive Madman
5cd53195fd Don't loose precision when parsing image size on 32 bit machines. Presumably fixes #8979.
Signed-off-by: Recursive Madman <recursive.madman@gmx.de>
2014-11-11 09:24:45 +01:00
Josh Hawn
059e589c34 Compute TarSum on storage of image layer content
Now, newly created/imported layers will have the checksum of
the layer diff computed and stored in the image json file.

For now, it is not an error if the computed checksum does not
match an existing checksum, only a warning message is logged. The
eventual goal is to use the checksums in the image JSON to verify
the integrity of the layer contents when doing `docker load` or
`docker pull`, and error out if it does not match.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-11-05 10:17:55 -08:00
unclejack
4dbbe4f51a image: stream img JSON & Decode in LoadImage
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-04 16:15:00 +02:00
Josh Hawn
26184de8ab Remove jsonData argument from image.StoreImage
The argument specified the json data to save to disk when registering
a new image into the image graph. If it is nil, then the given image
is serialized to json and that is written by default. This default
behavior is sufficient if the given image was originally deserialzed
from this jsonData to begin with which has always been the case.

Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-11-03 17:39:21 -08:00
Alexandr Morozov
ee7dd44c01 Mass gofmt
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:11:48 -07:00
Alexandr Morozov
7c62cee51e Use logrus everywhere for logging
Fixed #8761

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:03:06 -07:00
Rafe Colton
30d5a42c1f Move archive package into pkg/archive
Now that the archive package does not depend on any docker-specific
packages, only those in pkg and vendor, it can be safely moved into pkg.

Signed-off-by: Rafe Colton <rafael.colton@gmail.com>
2014-09-29 23:23:36 -07:00
Josh Hawn
dee6b481fe Refactor use of graphdriver.Differ
Some graphdrivers are Differs and type assertions are made
in various places throughout the project. Differ offers some
convenience in generating/applying diffs of filesystem layers
but for most graphdrivers another code path is taken.

This patch brings all of the logic related to filesystem
diffs in one place, and simplifies the implementation of some
common types like Image, Daemon, and Container.

Signed-off-by: Josh Hawn <josh.hawn@docker.com>
2014-09-16 15:10:32 -07:00
unclejack
76212635b5 move some io related utils to pkg/ioutils
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-09-03 11:36:21 +03:00
Solomon Hykes
2a39635d30 Cleanup: move image depth checks in image/
Signed-off-by: Solomon Hykes <solomon@docker.com>
2014-08-15 00:43:12 +00:00
Josiah Kiehl
a02f67be5b Extract log utils into pkg/log
Docker-DCO-1.1-Signed-off-by: Josiah Kiehl <josiah@capoferro.net> (github: capoferro)
2014-08-13 15:18:15 -07:00
Victor Vieux
b3ee9ac74e update go import path and libcontainer
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
2014-07-24 22:19:50 +00:00
Vincent Batts
d3bc787bca docker save: raw json
Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
2014-06-20 14:38:17 -04:00
Michael Crosby
f0e6e135a8 Initial work on selinux patch
This has every container using the docker daemon's pid for the processes
label so it does not work correctly.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-04-29 03:40:05 -07:00
Alexander Larsson
359b7df5d2 Rename runtime/* to daemon/*
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-04-17 14:43:01 -07:00
Michael Crosby
2bddcd68b4 Gofmt imports
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-03-17 11:41:28 -07:00
Michael Crosby
96c4816cef Move graphdrivers into runtime top level pkg
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-03-17 11:40:12 -07:00
Michael Crosby
82a5439835 Move image into sub pkg
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
2014-03-09 22:59:29 -07:00
Solomon Hykes
0f952a7dbb Removed deprecated docker/image module 2013-03-13 15:36:22 -07:00
shin-
2441edf1a3 Merged upstream changes in fs branch 2013-03-11 05:50:09 -07:00
shin-
97a8209438 Merged master branch into fs 2013-03-11 05:42:36 -07:00
Solomon Hykes
dd0227b700 Removed deprecated docker/image package 2013-03-09 20:17:31 -08:00
Solomon Hykes
c59fff422f gofmt 2013-03-09 19:44:09 -08:00
Solomon Hykes
791592731e Remove leftover debug message 2013-03-06 00:37:00 -08:00
Solomon Hykes
74c88fdbc0 docker rmi -r: remove all images matching a regexp 2013-03-05 22:39:43 -08:00
shin-
ffbb9c8e4a Merge branch 'master' into fs 2013-02-26 17:45:55 -08:00
Solomon Hykes
aa12da6f50 go fmt 2013-02-26 17:26:46 -08:00
Solomon Hykes
6d1054619d Added tests for checksum computation in layer store 2013-02-26 09:46:29 -08:00
Solomon Hykes
f437f5b8b4 'docker pull' and 'docker put' automatically detect tar compression (gzip, bzip2 or uncompressed). -j and -z flags are no longer required. 2013-02-22 12:28:25 -08:00
Solomon Hykes
5e2f0639c6 dockerd: create /var/lib/docker if it doesn't exist 2013-02-19 13:03:58 -08:00
Solomon Hykes
6372a1a0d0 docker/fs: initial support for filesystem layers (adapted from image/layers.go) 2013-02-18 15:25:43 -08:00
Solomon Hykes
059837c92a Upload or download gzipped and bzipped images with put/pull -j/-b 2013-02-12 22:23:14 -08:00
Solomon Hykes
de1c361a6e docker rmi: remove an image 2013-02-01 00:08:45 -08:00
Solomon Hykes
f8f9285cca Fix bug introduced in c7a944caf2 which caused 'docker images' to crash 2013-01-29 12:15:39 -08:00
Solomon Hykes
c7a944caf2 List containers ordered by creation time 2013-01-29 03:24:31 -08:00
Solomon Hykes
49da84d7c4 Fixed a bug which caused 'docker cp' to fail when the destination name already exists. 2013-01-28 23:17:47 -08:00
Solomon Hykes
2dadcf9b81 Fixed bug which caused AUFS layers to be mounted in the wrong order. 2013-01-28 23:15:02 -08:00
Solomon Hykes
904b0ab52b Experimenting with a UI which differentiates images and containers 2013-01-27 15:42:42 -08:00