Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

936 enhanced logging #1991

Closed
wants to merge 92 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
03e858c
- initial commit, add Errorf function
karlgrz Sep 17, 2013
fb43cdd
- use utils.Errorf where appropriate
karlgrz Sep 20, 2013
9cd4322
- more Errorf calls replacing Debugf
karlgrz Sep 23, 2013
4738c73
Merge remote-tracking branch 'upstream/master'
karlgrz Oct 1, 2013
8d94d99
- Add myself to AUTHORS
karlgrz Oct 3, 2013
ad63b1d
- Add myself to AUTHORS
karlgrz Oct 3, 2013
f3d3178
Merge remote-tracking branch 'upstream/master' into 936-enhanced-logging
karlgrz Oct 3, 2013
8df764e
Split stdout stderr for non-tty commands
Sep 10, 2013
cbbdeaf
Add stderr unit test
Sep 10, 2013
ae431d6
Make StdCopy works with huge amount of data
Sep 11, 2013
c99090a
Add documentation
Sep 11, 2013
cedefff
Update the commit documentation with better example
Sep 12, 2013
7fc20eb
Allow multiple volumes-from
crosbymichael Sep 14, 2013
90694a3
Fixed HTTP imports.
dsissitka-private Sep 16, 2013
1bc341d
Add Tianon to contrib/ maintainers
keeb Sep 16, 2013
2355c21
Prevent panic upon error pulling registry
Sep 16, 2013
ddb2a07
- initial commit, add Errorf function
karlgrz Sep 17, 2013
5fdb81c
packaging, issue #1647: Add docker groupname on the package release
mzdaniel Sep 16, 2013
f37863e
Update the devenvironment document
jalateras Sep 17, 2013
dd08314
Further updates to the dev environment document
jalateras Sep 17, 2013
f2dadc7
Further updates to the dev environment document
jalateras Sep 17, 2013
2550ef0
Bump version to 0.6.2
Sep 17, 2013
514eb39
Fix minor typo
keeb Sep 17, 2013
9e6a8bd
Fix #1654 Improve the introduction to repositories flow.
metaliveblog Sep 18, 2013
820a6d7
Updated the dev environment document
jalateras Sep 18, 2013
4023926
Update VERSION
Sep 18, 2013
cea4d6f
Docs: remove reference to deprecated 'base' image
Sep 18, 2013
0659499
Remove many remaining docs references to the deprecated `base` reposi…
tianon Sep 18, 2013
2375b6a
Simplify install instructions now that our overlay is in the official…
tianon Sep 19, 2013
d5df028
Download Ubuntu 13.04 repository key over HTTPS
jcassee Sep 19, 2013
023de97
Updated the section about extracting the binary
jalateras Sep 19, 2013
8583193
Modify repository name regex to match index
crosbymichael Sep 20, 2013
1e94342
Only copy files and change permissions with non bindmount
crosbymichael Sep 19, 2013
010e23c
Fix attach issue
Sep 20, 2013
305fc0c
Improve detach unit tests
Sep 20, 2013
9b5624a
- use utils.Errorf where appropriate
karlgrz Sep 20, 2013
7d2b24a
Merge pull request #1901 from jalateras/update-contributring-docs
metaliveblog Sep 20, 2013
5f12b9f
- more Errorf calls replacing Debugf
karlgrz Sep 23, 2013
dcda0fb
Update tar dependency to newest version
crosbymichael Sep 23, 2013
173ddd2
Hack: remove deprecated files
Sep 18, 2013
698faa8
hack/MAINTAINERS.md: a maintainer's manual.
Sep 19, 2013
d48cfd0
Hack: update release checklist and reference it in REAMDE
Sep 19, 2013
dc9a0a8
Update maintainer's manual: every change should be done in a pull req…
Sep 19, 2013
da27f4f
Hack: update README
Sep 19, 2013
ac9c812
Fix #1969 formatting, add information about multiline json
metaliveblog Sep 23, 2013
de33280
Bump to version v0.6.3
crosbymichael Sep 23, 2013
334175f
Add @tianon to hack/MAINTAINERS
tianon Sep 23, 2013
bb40d6d
Hack: correct typo in release checklist
Sep 24, 2013
09b8252
Minor spelling correction of protocoll -> protocol
Sep 24, 2013
775f31d
Add a few tweaks and fixes to contrib/mkimage-debian.sh
tianon Sep 13, 2013
cc2b0d1
various command fixes
blissdev Sep 24, 2013
04c6f73
use su instead of sudo
blissdev Sep 24, 2013
eaf6c12
Container: Always create a new session for the container
alexlarsson Sep 24, 2013
926bd3e
Fix #1993: add explanation for export restrictions
metaliveblog Sep 24, 2013
88b45dc
Add several of the small make.sh fixes from #1920, and make the outpu…
tianon Sep 23, 2013
7aa4401
revert removal of slash betwixt user/repo
blissdev Sep 24, 2013
36a5417
Update VERSION to 0.6.3-dev
crosbymichael Sep 25, 2013
25f4764
Replace deprecated upgrading reference to docker-latest.tgz, which ha…
tianon Sep 25, 2013
2c56453
Update Gentoo installation documentation now that we're in the portag…
tianon Sep 25, 2013
3a90505
fix the error message so it is the same as the regex issue #1999
kencochrane Sep 25, 2013
079a36e
Enable SSH Agent forwarding in Vagrant VM, so one is able to clone re…
jo-m Sep 25, 2013
c3f4be2
Add the X-Docker-Registry header and /v1/_ping endpoint
kyleconroy Sep 26, 2013
c98f8a7
Remove smart quotes. Add the X-Docker-Token header
kyleconroy Sep 26, 2013
a7591ee
Fix Authorization headers
kyleconroy Sep 26, 2013
394d8aa
lxc: Allow set_file_cap capability in container
alexlarsson Sep 26, 2013
5fcdba0
Configured FPM to make /etc/init/docker.conf a config file.
dsissitka-private Sep 26, 2013
0121838
Hint for Remote API doc details in header links
cdunklau Sep 26, 2013
c270b47
Used tabs for alignment when I should've used spaces. Fixed.
dsissitka-private Sep 26, 2013
b0f1525
Move run -rm to the cli only
crosbymichael Sep 26, 2013
1c63466
Fix copypasta errors
kyleconroy Sep 26, 2013
c787e58
Update docs + fix endian issue
Sep 26, 2013
585431a
Clearly point at detailed docs
cdunklau Sep 27, 2013
ab1cf4c
automatically remove container via -rm
unclejack Aug 15, 2013
3d2eec1
add .dockercfg doc
vieux Sep 27, 2013
6914d15
Fix the attach behavior with -i
Sep 24, 2013
5138ab7
Added more context.
metaliveblog Sep 28, 2013
2e21634
Changes to a new style for the docs. Includes version switcher.
dhrp Sep 25, 2013
ecd6899
Add contrib/mkimage-centos.sh back (from #1621), and associated docum…
tianon Sep 28, 2013
e4cbf7e
fix panic with wrong dockercfg file
vieux Sep 30, 2013
a4b21e8
Update archlinux.rst
Sep 30, 2013
5ffbac8
Add cleanup/refactor portion of #2010 for hack and Dockerfile updates
tianon Sep 30, 2013
d189a3d
Update archlinux.rst
Sep 30, 2013
1eddb5f
fix logo path
metaliveblog Sep 30, 2013
4dd2fca
Fix ironic typo in changelog
marcusramberg Oct 1, 2013
422aab1
Fix Ping endpoint documentation
kyleconroy Oct 1, 2013
d091bef
Add/modified the canonical link to work with all /index/ links. Added…
dhrp Oct 1, 2013
6666d8f
Cleanup
dhrp Oct 1, 2013
31268ef
Bump vendor kr/pty to commit 3b1f6487b (syscall.O_NOCTTY)
tianon Oct 2, 2013
f41406b
fix(hack/PACKAGERS): add xz utils as a runtime dep
Oct 2, 2013
8a77834
Remove Gentoo install notes about #1422 workaround
tianon Oct 2, 2013
fa72c5c
Update ubuntu docs to use wget instead of curl
mastahyeti Oct 1, 2013
ee9e5b2
Merge branch '936-enhanced-logging' of ssh://github.com/karlgrz/docke…
karlgrz Oct 3, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Jonathan Rudenberg <jonathan@titanous.com>
Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
Julien Barbier <write0@gmail.com>
Jérôme Petazzoni <jerome.petazzoni@dotcloud.com>
Karl Grzeszczak <karl@karlgrz.com>
Karan Lyons <karan@karanlyons.com>
Keli Hu <dev@keli.hu>
Ken Cochrane <kencochrane@gmail.com>
Expand Down
16 changes: 8 additions & 8 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func httpError(w http.ResponseWriter, err error) {
} else if strings.Contains(err.Error(), "hasn't been activated") {
statusCode = http.StatusForbidden
}
utils.Debugf("[error %d] %s", statusCode, err)
utils.Errorf("[error %d] %s", statusCode, err)
http.Error(w, err.Error(), statusCode)
}

Expand Down Expand Up @@ -102,7 +102,7 @@ func getBoolParam(value string) (bool, error) {
func matchesContentType(contentType, expectedType string) bool {
mimetype, _, err := mime.ParseMediaType(contentType)
if err != nil {
utils.Debugf("Error parsing media type: %s error: %s", contentType, err.Error())
utils.Errorf("Error parsing media type: %s error: %s", contentType, err.Error())
}
return err == nil && mimetype == expectedType
}
Expand Down Expand Up @@ -147,7 +147,7 @@ func getContainersExport(srv *Server, version float64, w http.ResponseWriter, r
name := vars["name"]

if err := srv.ContainerExport(name, w); err != nil {
utils.Debugf("%s", err)
utils.Errorf("%s", err)
return err
}
return nil
Expand Down Expand Up @@ -192,7 +192,7 @@ func getEvents(srv *Server, version float64, w http.ResponseWriter, r *http.Requ
_, err = wf.Write(b)
if err != nil {
// On error, evict the listener
utils.Debugf("%s", err)
utils.Errorf("%s", err)
srv.Lock()
delete(srv.listeners, r.RemoteAddr)
srv.Unlock()
Expand Down Expand Up @@ -347,7 +347,7 @@ func postCommit(srv *Server, version float64, w http.ResponseWriter, r *http.Req
}
config := &Config{}
if err := json.NewDecoder(r.Body).Decode(config); err != nil {
utils.Debugf("%s", err)
utils.Errorf("%s", err)
}
repo := r.Form.Get("repo")
tag := r.Form.Get("tag")
Expand Down Expand Up @@ -792,7 +792,7 @@ func wsContainersAttach(srv *Server, version float64, w http.ResponseWriter, r *
defer ws.Close()

if err := srv.ContainerAttach(name, logs, stream, stdin, stdout, stderr, ws, ws, ws); err != nil {
utils.Debugf("Error: %s", err)
utils.Errorf("Error: %s", err)
}
})
h.ServeHTTP(w, r)
Expand Down Expand Up @@ -938,7 +938,7 @@ func postContainersCopy(srv *Server, version float64, w http.ResponseWriter, r *
}

if err := srv.ContainerCopy(name, copyData.Resource, w); err != nil {
utils.Debugf("%s", err.Error())
utils.Errorf("%s", err.Error())
return err
}
return nil
Expand Down Expand Up @@ -983,7 +983,7 @@ func makeHttpHandler(srv *Server, logging bool, localMethod string, localRoute s
}

if err := handlerFunc(srv, version, w, r, mux.Vars(r)); err != nil {
utils.Debugf("Error: %s", err)
utils.Errorf("Error: %s", err)
httpError(w, err)
}
}
Expand Down
4 changes: 2 additions & 2 deletions buildfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func (b *buildFile) CmdEnv(args string) error {
func (b *buildFile) CmdCmd(args string) error {
var cmd []string
if err := json.Unmarshal([]byte(args), &cmd); err != nil {
utils.Debugf("Error unmarshalling: %s, setting cmd to /bin/sh -c", err)
utils.Errorf("Error unmarshalling: %s, setting cmd to /bin/sh -c", err)
cmd = []string{"/bin/sh", "-c", args}
}
if err := b.commit("", cmd, fmt.Sprintf("CMD %v", cmd)); err != nil {
Expand Down Expand Up @@ -296,7 +296,7 @@ func (b *buildFile) addContext(container *Container, orig, dest string) error {
}
// First try to unpack the source as an archive
} else if err := UntarPath(origPath, destPath); err != nil {
utils.Debugf("Couldn't untar %s to %s: %s", origPath, destPath, err)
utils.Errorf("Couldn't untar %s to %s: %s", origPath, destPath, err)
// If that fails, just copy it as a regular file
if err := os.MkdirAll(path.Dir(destPath), 0755); err != nil {
return err
Expand Down
18 changes: 9 additions & 9 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func (cli *DockerCli) CmdVersion(args ...string) error {
var out APIVersion
err = json.Unmarshal(body, &out)
if err != nil {
utils.Debugf("Error unmarshal: body: %s, err: %s\n", body, err)
utils.Errorf("Error unmarshal: body: %s, err: %s\n", body, err)
return err
}
if out.Version != "" {
Expand Down Expand Up @@ -1533,7 +1533,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
if config.AttachStdin || config.AttachStdout || config.AttachStderr {
if config.Tty {
if err := cli.monitorTtySize(runResult.ID); err != nil {
utils.Debugf("Error monitoring TTY size: %s\n", err)
utils.Errorf("Error monitoring TTY size: %s\n", err)
}
}

Expand Down Expand Up @@ -1570,7 +1570,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
}()

if err := cli.hijack("POST", "/containers/"+runResult.ID+"/attach?"+v.Encode(), config.Tty, cli.in, out, stderr); err != nil {
utils.Debugf("Error hijack: %s", err)
utils.Errorf("Error hijack: %s", err)
return err
}
}
Expand Down Expand Up @@ -1798,11 +1798,11 @@ func (cli *DockerCli) hijack(method, path string, setRawTerminal bool, in io.Rea
}
if tcpc, ok := rwc.(*net.TCPConn); ok {
if err := tcpc.CloseWrite(); err != nil {
utils.Debugf("Couldn't send EOF: %s\n", err)
utils.Errorf("Couldn't send EOF: %s\n", err)
}
} else if unixc, ok := rwc.(*net.UnixConn); ok {
if err := unixc.CloseWrite(); err != nil {
utils.Debugf("Couldn't send EOF: %s\n", err)
utils.Errorf("Couldn't send EOF: %s\n", err)
}
}
// Discard errors due to pipe interruption
Expand All @@ -1811,14 +1811,14 @@ func (cli *DockerCli) hijack(method, path string, setRawTerminal bool, in io.Rea

if stdout != nil {
if err := <-receiveStdout; err != nil {
utils.Debugf("Error receiveStdout: %s", err)
utils.Errorf("Error receiveStdout: %s", err)
return err
}
}

if !cli.isTerminal {
if err := <-sendStdin; err != nil {
utils.Debugf("Error sendStdin: %s", err)
utils.Errorf("Error sendStdin: %s", err)
return err
}
}
Expand All @@ -1832,7 +1832,7 @@ func (cli *DockerCli) getTtySize() (int, int) {
}
ws, err := term.GetWinsize(cli.terminalFd)
if err != nil {
utils.Debugf("Error getting size: %s", err)
utils.Errorf("Error getting size: %s", err)
if ws == nil {
return 0, 0
}
Expand All @@ -1849,7 +1849,7 @@ func (cli *DockerCli) resizeTty(id string) {
v.Set("h", strconv.Itoa(height))
v.Set("w", strconv.Itoa(width))
if _, _, err := cli.call("POST", "/containers/"+id+"/resize?"+v.Encode(), nil); err != nil {
utils.Debugf("Error resize: %s", err)
utils.Errorf("Error resize: %s", err)
}
}

Expand Down
31 changes: 19 additions & 12 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ type HostConfig struct {
Binds []string
ContainerIDFile string
LxcConf []KeyValuePair
AutoRemove bool
}

type BindMap struct {
Expand Down Expand Up @@ -247,6 +248,7 @@ func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig,
Binds: binds,
ContainerIDFile: *flContainerIDFile,
LxcConf: lxcConf,
AutoRemove: *flAutoRemove,
}

if capabilities != nil && *flMemory > 0 && !capabilities.SwapLimit {
Expand Down Expand Up @@ -461,7 +463,7 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
_, err = io.Copy(cStdin, stdin)
}
if err != nil {
utils.Debugf("[error] attach stdin: %s\n", err)
utils.Errorf("[error] attach stdin: %s\n", err)
}
// Discard error, expecting pipe error
errors <- nil
Expand All @@ -486,7 +488,7 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
}
_, err := io.Copy(stdout, cStdout)
if err != nil {
utils.Debugf("[error] attach stdout: %s\n", err)
utils.Errorf("[error] attach stdout: %s\n", err)
}
errors <- err
}()
Expand All @@ -498,7 +500,7 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
}

if cStdout, err := container.StdoutPipe(); err != nil {
utils.Debugf("Error stdout pipe")
utils.Errorf("Error stdout pipe")
} else {
io.Copy(&utils.NopWriter{}, cStdout)
}
Expand All @@ -522,7 +524,7 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
}
_, err := io.Copy(stderr, cStderr)
if err != nil {
utils.Debugf("[error] attach stderr: %s\n", err)
utils.Errorf("[error] attach stderr: %s\n", err)
}
errors <- err
}()
Expand All @@ -534,7 +536,7 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
}

if cStderr, err := container.StderrPipe(); err != nil {
utils.Debugf("Error stdout pipe")
utils.Errorf("Error stdout pipe")
} else {
io.Copy(&utils.NopWriter{}, cStderr)
}
Expand All @@ -553,7 +555,7 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
for i := 0; i < nJobs; i += 1 {
utils.Debugf("Waiting for job %d/%d\n", i+1, nJobs)
if err := <-errors; err != nil {
utils.Debugf("Job %d returned error %s. Aborting all jobs\n", i+1, err)
utils.Errorf("Job %d returned error %s. Aborting all jobs\n", i+1, err)
return err
}
utils.Debugf("Job %d completed successfully\n", i+1)
Expand Down Expand Up @@ -958,12 +960,12 @@ func (container *Container) monitor(hostConfig *HostConfig) {
// If the command does not exists, try to wait via lxc
if container.cmd == nil {
if err := container.waitLxc(); err != nil {
utils.Debugf("%s: Process: %s", container.ID, err)
utils.Errorf("%s: Process: %s", container.ID, err)
}
} else {
if err := container.cmd.Wait(); err != nil {
// Discard the error as any signals or non 0 returns will generate an error
utils.Debugf("%s: Process: %s", container.ID, err)
utils.Errorf("%s: Process: %s", container.ID, err)
}
}
utils.Debugf("Process finished")
Expand All @@ -984,19 +986,19 @@ func (container *Container) monitor(hostConfig *HostConfig) {
container.releaseNetwork()
if container.Config.OpenStdin {
if err := container.stdin.Close(); err != nil {
utils.Debugf("%s: Error close stdin: %s", container.ID, err)
utils.Errorf("%s: Error close stdin: %s", container.ID, err)
}
}
if err := container.stdout.CloseWriters(); err != nil {
utils.Debugf("%s: Error close stdout: %s", container.ID, err)
utils.Errorf("%s: Error close stdout: %s", container.ID, err)
}
if err := container.stderr.CloseWriters(); err != nil {
utils.Debugf("%s: Error close stderr: %s", container.ID, err)
utils.Errorf("%s: Error close stderr: %s", container.ID, err)
}

if container.ptyMaster != nil {
if err := container.ptyMaster.Close(); err != nil {
utils.Debugf("%s: Error closing Pty master: %s", container.ID, err)
utils.Errorf("%s: Error closing Pty master: %s", container.ID, err)
}
}

Expand All @@ -1021,6 +1023,11 @@ func (container *Container) monitor(hostConfig *HostConfig) {
// FIXME: why are we serializing running state to disk in the first place?
//log.Printf("%s: Failed to dump configuration to the disk: %s", container.ID, err)
}
if hostConfig != nil {
if hostConfig.AutoRemove {
container.runtime.Destroy(container)
}
}
}

func (container *Container) kill() error {
Expand Down
14 changes: 14 additions & 0 deletions docs/sources/api/docker_remote_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ v1.5
Full Documentation
------------------

:doc:`docker_remote_api_v1.5`

What's new
----------

.. http:post:: /containers/(id)/attach

**New!** You can now split stderr from stdout. This is done by prefixing
a header to each transmition. See :http:post:`/containers/(id)/attach`.
The WebSocket attach is unchanged.
Note that attach calls on the previous API version didn't change. Stdout and
stderr are merged.


:doc:`docker_remote_api_v1.5`

What's new
Expand Down
2 changes: 1 addition & 1 deletion mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func Unmount(target string) error {
if err := exec.Command("auplink", target, "flush").Run(); err != nil {
utils.Debugf("[warning]: couldn't run auplink before unmount: %s", err)
utils.Errorf("[warning]: couldn't run auplink before unmount: %s", err)
}
if err := syscall.Unmount(target, 0); err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions network_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (proxy *TCPProxy) Run() {
for {
client, err := proxy.listener.Accept()
if err != nil {
utils.Debugf("Stopping proxy on tcp/%v for tcp/%v (%v)", proxy.frontendAddr, proxy.backendAddr, err.Error())
utils.Errorf("Stopping proxy on tcp/%v for tcp/%v (%v)", proxy.frontendAddr, proxy.backendAddr, err.Error())
return
}
go proxy.clientLoop(client.(*net.TCPConn), quit)
Expand Down Expand Up @@ -205,7 +205,7 @@ func (proxy *UDPProxy) Run() {
// NOTE: Apparently ReadFrom doesn't return
// ECONNREFUSED like Read do (see comment in
// UDPProxy.replyLoop)
utils.Debugf("Stopping proxy on udp/%v for udp/%v (%v)", proxy.frontendAddr, proxy.backendAddr, err.Error())
utils.Errorf("Stopping proxy on udp/%v for udp/%v (%v)", proxy.frontendAddr, proxy.backendAddr, err.Error())
break
}

Expand Down
2 changes: 1 addition & 1 deletion runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func (runtime *Runtime) restore() error {
fmt.Printf("\b%c", wheel[i%4])
}
if err != nil {
utils.Debugf("Failed to load container %v: %v", id, err)
utils.Errorf("Failed to load container %v: %v", id, err)
continue
}
utils.Debugf("Loaded container %v", container.ID)
Expand Down
Loading