View findCommon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"path/filepath" | |
"strings" | |
) | |
func findCommon(paths []string) string { | |
sep := string(filepath.Separator) |
View gist:3bc009861e58f381dafe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func GetTimestamp(value string) string { | |
format := RFC3339NanoFixed | |
loc := time.FixedZone(time.Now().Zone()) | |
if len(value) < len(format) { | |
format = format[:len(value)] | |
} | |
var shift time.Duration | |
if i := strings.Index(value, "Z"); i > 0 && i != len(value)-1 { | |
parts := strings.SplitN(value[i+1:], ":", 2) |
View gist:689b041823602de05e00
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type ErrorCode struct { | |
code int | |
next *ErrorCode | |
} |
View gist:eca6bf5c9d1ed6cd8bc1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In container: | |
/tmp/f1 | |
/tmp/f2 | |
/tmp/dir/f1 | |
/tmp/dir/f2 | |
CMD: docker cp container:source target | |
Source Target Body (tar unless otherwise indicated) Stat Hdr Result | |
/tmp . tmp + tmp/f1, tmp/f2, tmp/dir/f1, tmp/dir/f2 tmp stat ./tmp/... |
View gist:a1a139791972e4cad37c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PR Branch: https://github.com/duglin/docker/tree/Deprecate | |
Right now Docker's development is a bit constrained by the requirement to be backwards compatible. | |
Normally minor releases (e.g. 1.2 -> 1.3) are required to be backwards compatible, and that makes | |
a lot of sense for stable products that have a regular major release update schedule. | |
However, Docker is still (relatively) new and as such some of the original design decisions are | |
no longer correct, but we are forced to support them for, what feels like, forever. In addition, | |
there are cases where we decline to offer a better alternative because we would then feel | |
compelled to support both forever - and usually having more than one way to do something is bad. |
View docker daemon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: docker [OPTIONS] COMMAND [arg...] | |
docker daemon [arg...] | |
docker [ -h | --help | -v | --version ] | |
A self-sufficient runtime for containers. | |
Options: | |
--config=~/.docker Location of client config files | |
-D, --debug=false Enable debug mode | |
-H, --host=[] Daemon socket(s) to connect to |
View Errors Explained
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tl;dr: | |
- Each unique error message that flows on the wire should use the error processing package. | |
- This means each unique error message will have a unique ID associated with it. | |
- Errors generated by libraries, non-Docker-specific code or that are not seen on the wire | |
can/should continue to use the standard go-lang error mechanisms. | |
Meaning: strings, types, etc... e.g. https://golang.org/src/os/file.go - line 84 | |
- Each error, defined using the error processing package, will be self-describing. Which includes: | |
- unique ID | |
- error text | |
- descriptive text |
View gist:cd9ef1e6ef4ba346f05c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu | |
ENV foo=bar | |
RUN asdasd || echo hi | |
RUN 123 | |
$ docker build . > out 2> err | |
$ cat out | |
Sending build context to Docker daemon 40.09 MB |
View gist:36078ea6c84232d014b6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker rmi sha256:7b521 | |
Error response from daemon: unrecognized image ID sha256:7b521 | |
Error: failed to remove images: [sha256:7b521] | |
$ docker rmi 7b521 | |
Deleted: sha256:7b521c3b64737ed5e5fe1b92c451a980fea823e6af8b020979a26fc09582b977 | |
Deleted: sha256:94c29bb0663a983ac21bd7b4c9b6d18977a2cc16eaba846fa9d58738d118680c |
View gist:b8d2282d7ac8b091beba
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/daemon/daemon.go b/daemon/daemon.go | |
index 6a8d18e..f82bcdb 100644 | |
--- a/daemon/daemon.go | |
+++ b/daemon/daemon.go | |
@@ -1236,6 +1236,10 @@ func (daemon *Daemon) ImageHistory(name string) ([]*types | |
// GetImageID returns an image ID corresponding to the image referred to by | |
// refOrID. | |
func (daemon *Daemon) GetImageID(refOrID string) (image.ID, error) { | |
+ if i := strings.Index(refOrID, ":"); i >= 0 { | |
+ refOrID = refOrID[i+1:] |