Skip to content

Commit

Permalink
Merge pull request moby#17852 from tiborvass/bump_v1.9.1
Browse files Browse the repository at this point in the history
Bump v1.9.1
  • Loading branch information
calavera committed Nov 20, 2015
2 parents 7e5506d + a34a1d5 commit f4c9adf
Show file tree
Hide file tree
Showing 87 changed files with 1,608 additions and 395 deletions.
40 changes: 40 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,46 @@ information on the list of deprecated flags and APIs please have a look at
https://docs.docker.com/misc/deprecated/ where target removal dates can also
be found.

## 1.9.1

## Runtime

- Do not prevent daemon from booting if images could not be restored (#17695)
- Force IPC mount to unmount on daemon shutdown/init (#17539)
- Turn IPC unmount errors into warnings (#17554)
- Fix `docker stats` performance regression (#17638)
- Clarify cryptic error message upon `docker logs` if `--log-driver=none` (#17767)
- Fix seldom panics (#17639, #17634, #17703)
- Fix opq whiteouts problems for files with dot prefix (#17819)
- devicemapper: try defaulting to xfs instead of ext4 for performance reasons (#17903, #17918)
- devicemapper: fix displayed fs in docker info (#17974)
- selinux: only relabel if user requested so with the `z` option (#17450, #17834)
- Do not make network calls when normalizing names (#18014)

## Client

- Fix `docker login` on windows (#17738)
- Fix bug with `docker inspect` output when not connected to daemon (#17715)
- Fix `docker inspect -f {{.HostConfig.Dns}} somecontainer` (#17680)

## Builder

- Fix regression with symlink behavior in ADD/COPY (#17710)

## Networking

- Allow passing a network ID as an argument for `--net` (#17558)
- Fix connect to host and prevent disconnect from host for `host` network (#17476)
- Fix `--fixed-cidr` issue when gateway ip falls in ip-range and ip-range is
not the first block in the network (#17853)
- Restore deterministic `IPv6` generation from `MAC` address on default `bridge` network (#17890)
- Allow port-mapping only for endpoints created on docker run (#17858)
- Fixed an endpoint delete issue with a possible stale sbox (#18102)

## Distribution

- Correct parent chain in v2 push when v1Compatibility files on the disk are inconsistent (#18047)

## 1.9.0 (2015-11-03)

## Runtime
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Expand Up @@ -58,6 +58,7 @@ RUN apt-get update && apt-get install -y \
ruby1.9.1-dev \
s3cmd=1.1.0* \
ubuntu-zfs \
xfsprogs \
libzfs-dev \
--no-install-recommends

Expand Down
1 change: 1 addition & 0 deletions Dockerfile.simple
Expand Up @@ -23,6 +23,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
e2fsprogs \
iptables \
procps \
xfsprogs \
xz-utils \
\
aufs-tools \
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
1.9.0
1.9.1
23 changes: 15 additions & 8 deletions api/client/inspect.go
Expand Up @@ -61,21 +61,29 @@ func (cli *DockerCli) CmdInspect(args ...string) error {
for _, name := range cmd.Args() {
if *inspectType == "" || *inspectType == "container" {
obj, _, err = readBody(cli.call("GET", "/containers/"+name+"/json?"+v.Encode(), nil, nil))
if err != nil && *inspectType == "container" {
if strings.Contains(err.Error(), "No such") {
fmt.Fprintf(cli.err, "Error: No such container: %s\n", name)
} else {
fmt.Fprintf(cli.err, "%s", err)
if err != nil {
if err == errConnectionFailed {
return err
}
if *inspectType == "container" {
if strings.Contains(err.Error(), "No such") {
fmt.Fprintf(cli.err, "Error: No such container: %s\n", name)
} else {
fmt.Fprintf(cli.err, "%s", err)
}
status = 1
continue
}
status = 1
continue
}
}

if obj == nil && (*inspectType == "" || *inspectType == "image") {
obj, _, err = readBody(cli.call("GET", "/images/"+name+"/json", nil, nil))
isImage = true
if err != nil {
if err == errConnectionFailed {
return err
}
if strings.Contains(err.Error(), "No such") {
if *inspectType == "" {
fmt.Fprintf(cli.err, "Error: No such image or container: %s\n", name)
Expand All @@ -88,7 +96,6 @@ func (cli *DockerCli) CmdInspect(args ...string) error {
status = 1
continue
}

}

if tmpl == nil {
Expand Down
6 changes: 6 additions & 0 deletions api/client/login.go
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"
"os"
"runtime"
"strings"

"github.com/docker/docker/api/types"
Expand Down Expand Up @@ -33,6 +34,11 @@ func (cli *DockerCli) CmdLogin(args ...string) error {

cmd.ParseFlags(args, true)

// On Windows, force the use of the regular OS stdin stream. Fixes #14336/#14210
if runtime.GOOS == "windows" {
cli.in = os.Stdin
}

serverAddress := registry.IndexServer
if len(cmd.Args()) > 0 {
serverAddress = cmd.Arg(0)
Expand Down
10 changes: 10 additions & 0 deletions api/client/logs.go
Expand Up @@ -2,6 +2,7 @@ package client

import (
"encoding/json"
"fmt"
"net/url"
"time"

Expand All @@ -11,6 +12,11 @@ import (
"github.com/docker/docker/pkg/timeutils"
)

var validDrivers = map[string]bool{
"json-file": true,
"journald": true,
}

// CmdLogs fetches the logs of a given container.
//
// docker logs [OPTIONS] CONTAINER
Expand All @@ -36,6 +42,10 @@ func (cli *DockerCli) CmdLogs(args ...string) error {
return err
}

if !validDrivers[c.HostConfig.LogConfig.Type] {
return fmt.Errorf("\"logs\" command is supported only for \"json-file\" and \"journald\" logging drivers (got: %s)", c.HostConfig.LogConfig.Type)
}

v := url.Values{}
v.Set("stdout", "1")
v.Set("stderr", "1")
Expand Down
15 changes: 11 additions & 4 deletions api/server/router/local/container.go
Expand Up @@ -66,7 +66,9 @@ func (s *router) getContainersStats(ctx context.Context, w http.ResponseWriter,
w.Header().Set("Content-Type", "application/json")
out = w
} else {
out = ioutils.NewWriteFlusher(w)
wf := ioutils.NewWriteFlusher(w)
out = wf
defer wf.Close()
}

var closeNotifier <-chan bool
Expand Down Expand Up @@ -122,11 +124,16 @@ func (s *router) getContainersLogs(ctx context.Context, w http.ResponseWriter, r
return derr.ErrorCodeNoSuchContainer.WithArgs(containerName)
}

outStream := ioutils.NewWriteFlusher(w)
// write an empty chunk of data (this is to ensure that the
// HTTP Response is sent immediately, even if the container has
// not yet produced any data)
outStream.Write(nil)
w.WriteHeader(http.StatusOK)
if flusher, ok := w.(http.Flusher); ok {
flusher.Flush()
}

output := ioutils.NewWriteFlusher(w)
defer output.Close()

logsConfig := &daemon.ContainerLogsConfig{
Follow: httputils.BoolValue(r, "follow"),
Expand All @@ -135,7 +142,7 @@ func (s *router) getContainersLogs(ctx context.Context, w http.ResponseWriter, r
Tail: r.Form.Get("tail"),
UseStdout: stdout,
UseStderr: stderr,
OutStream: outStream,
OutStream: output,
Stop: closeNotifier,
}

Expand Down
4 changes: 4 additions & 0 deletions api/server/router/local/image.go
Expand Up @@ -105,6 +105,7 @@ func (s *router) postImagesCreate(ctx context.Context, w http.ResponseWriter, r
err error
output = ioutils.NewWriteFlusher(w)
)
defer output.Close()

w.Header().Set("Content-Type", "application/json")

Expand Down Expand Up @@ -188,6 +189,7 @@ func (s *router) postImagesPush(ctx context.Context, w http.ResponseWriter, r *h

name := vars["name"]
output := ioutils.NewWriteFlusher(w)
defer output.Close()
imagePushConfig := &graph.ImagePushConfig{
MetaHeaders: metaHeaders,
AuthConfig: authConfig,
Expand Down Expand Up @@ -218,6 +220,7 @@ func (s *router) getImagesGet(ctx context.Context, w http.ResponseWriter, r *htt
w.Header().Set("Content-Type", "application/x-tar")

output := ioutils.NewWriteFlusher(w)
defer output.Close()
var names []string
if name, ok := vars["name"]; ok {
names = []string{name}
Expand Down Expand Up @@ -297,6 +300,7 @@ func (s *router) postBuild(ctx context.Context, w http.ResponseWriter, r *http.R

version := httputils.VersionFromContext(ctx)
output := ioutils.NewWriteFlusher(w)
defer output.Close()
sf := streamformatter.NewJSONStreamFormatter()
errf := func(err error) error {
// Do not write the error in the http output if it's still empty.
Expand Down
24 changes: 13 additions & 11 deletions api/server/router/local/info.go
Expand Up @@ -52,16 +52,6 @@ func (s *router) getInfo(ctx context.Context, w http.ResponseWriter, r *http.Req
return httputils.WriteJSON(w, http.StatusOK, info)
}

func buildOutputEncoder(w http.ResponseWriter) *json.Encoder {
w.Header().Set("Content-Type", "application/json")
outStream := ioutils.NewWriteFlusher(w)
// Write an empty chunk of data.
// This is to ensure that the HTTP status code is sent immediately,
// so that it will not block the receiver.
outStream.Write(nil)
return json.NewEncoder(outStream)
}

func (s *router) getEvents(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
Expand All @@ -87,7 +77,19 @@ func (s *router) getEvents(ctx context.Context, w http.ResponseWriter, r *http.R
return err
}

enc := buildOutputEncoder(w)
w.Header().Set("Content-Type", "application/json")

// This is to ensure that the HTTP status code is sent immediately,
// so that it will not block the receiver.
w.WriteHeader(http.StatusOK)
if flusher, ok := w.(http.Flusher); ok {
flusher.Flush()
}

output := ioutils.NewWriteFlusher(w)
defer output.Close()

enc := json.NewEncoder(output)
d := s.daemon
es := d.EventsService
current, l := es.Subscribe()
Expand Down
13 changes: 11 additions & 2 deletions api/server/router/network/network_routes.go
Expand Up @@ -199,7 +199,11 @@ func buildNetworkResource(nw libnetwork.Network) *types.NetworkResource {

epl := nw.Endpoints()
for _, e := range epl {
sb := e.Info().Sandbox()
ei := e.Info()
if ei == nil {
continue
}
sb := ei.Sandbox()
if sb == nil {
continue
}
Expand Down Expand Up @@ -241,7 +245,12 @@ func buildEndpointResource(e libnetwork.Endpoint) types.EndpointResource {
}

er.EndpointID = e.ID()
if iface := e.Info().Iface(); iface != nil {
ei := e.Info()
if ei == nil {
return er
}

if iface := ei.Iface(); iface != nil {
if mac := iface.MacAddress(); mac != nil {
er.MacAddress = mac.String()
}
Expand Down
13 changes: 12 additions & 1 deletion builder/builder.go
Expand Up @@ -33,7 +33,8 @@ type Context interface {
Close() error
// Stat returns an entry corresponding to path if any.
// It is recommended to return an error if path was not found.
Stat(path string) (FileInfo, error)
// If path is a symlink it also returns the path to the target file.
Stat(path string) (string, FileInfo, error)
// Open opens path from the context and returns a readable stream of it.
Open(path string) (io.ReadCloser, error)
// Walk walks the tree of the context with the function passed to it.
Expand Down Expand Up @@ -64,13 +65,23 @@ type PathFileInfo struct {
os.FileInfo
// FilePath holds the absolute path to the file.
FilePath string
// Name holds the basename for the file.
FileName string
}

// Path returns the absolute path to the file.
func (fi PathFileInfo) Path() string {
return fi.FilePath
}

// Name returns the basename of the file.
func (fi PathFileInfo) Name() string {
if fi.FileName != "" {
return fi.FileName
}
return fi.FileInfo.Name()
}

// Hashed defines an extra method intended for implementations of os.FileInfo.
type Hashed interface {
// Hash returns the hash of a file.
Expand Down
13 changes: 7 additions & 6 deletions builder/dockerfile/internals.go
Expand Up @@ -366,7 +366,7 @@ func (b *Builder) calcCopyInfo(cmdName, origPath string, allowLocalDecompression

// Must be a dir or a file

fi, err := b.context.Stat(origPath)
statPath, fi, err := b.context.Stat(origPath)
if err != nil {
return nil, err
}
Expand All @@ -383,18 +383,19 @@ func (b *Builder) calcCopyInfo(cmdName, origPath string, allowLocalDecompression
hfi.SetHash("file:" + hfi.Hash())
return copyInfos, nil
}

// Must be a dir

var subfiles []string
b.context.Walk(origPath, func(path string, info builder.FileInfo, err error) error {
err = b.context.Walk(statPath, func(path string, info builder.FileInfo, err error) error {
if err != nil {
return err
}
// we already checked handleHash above
subfiles = append(subfiles, info.(builder.Hashed).Hash())
return nil
})
if err != nil {
return nil, err
}

sort.Strings(subfiles)
hasher := sha256.New()
Expand Down Expand Up @@ -604,9 +605,9 @@ func (b *Builder) readDockerfile() error {
// back to 'Dockerfile' and use that in the error message.
if b.DockerfileName == "" {
b.DockerfileName = api.DefaultDockerfileName
if _, err := b.context.Stat(b.DockerfileName); os.IsNotExist(err) {
if _, _, err := b.context.Stat(b.DockerfileName); os.IsNotExist(err) {
lowercase := strings.ToLower(b.DockerfileName)
if _, err := b.context.Stat(lowercase); err == nil {
if _, _, err := b.context.Stat(lowercase); err == nil {
b.DockerfileName = lowercase
}
}
Expand Down

0 comments on commit f4c9adf

Please sign in to comment.