Skip to content

Commit

Permalink
Merge pull request #22242 from mlaventure/1.11.1-cherry-pick
Browse files Browse the repository at this point in the history
1.11.1 cherry pick
  • Loading branch information
tiborvass committed Apr 26, 2016
2 parents 0344639 + 61c0f4b commit 7ef1cfd
Show file tree
Hide file tree
Showing 72 changed files with 764 additions and 490 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ RUN set -x \
&& rm -rf "$GOPATH"

# Install runc
ENV RUNC_COMMIT e87436998478d222be209707503c27f6f91be0c5
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \
Expand All @@ -258,7 +258,7 @@ RUN set -x \
&& cp runc /usr/local/bin/docker-runc

# Install containerd
ENV CONTAINERD_COMMIT d2f03861c91edaafdcb3961461bf82ae83785ed7
ENV CONTAINERD_COMMIT v0.2.1
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone git://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ RUN set -x \
&& rm -rf "$GOPATH"

# Install runc
ENV RUNC_COMMIT e87436998478d222be209707503c27f6f91be0c5
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \
Expand All @@ -191,7 +191,7 @@ RUN set -x \
&& cp runc /usr/local/bin/docker-runc

# Install containerd
ENV CONTAINERD_COMMIT d2f03861c91edaafdcb3961461bf82ae83785ed7
ENV CONTAINERD_COMMIT v0.2.1
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone git://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.armhf
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ RUN set -x \
&& rm -rf "$GOPATH"

# Install runc
ENV RUNC_COMMIT e87436998478d222be209707503c27f6f91be0c5
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \
Expand All @@ -210,7 +210,7 @@ RUN set -x \
&& cp runc /usr/local/bin/docker-runc

# Install containerd
ENV CONTAINERD_COMMIT d2f03861c91edaafdcb3961461bf82ae83785ed7
ENV CONTAINERD_COMMIT v0.2.1
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone git://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.gccgo
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ WORKDIR /go/src/github.com/docker/docker
ENV DOCKER_BUILDTAGS apparmor seccomp selinux

# Install runc
ENV RUNC_COMMIT e87436998478d222be209707503c27f6f91be0c5
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \
Expand All @@ -84,7 +84,7 @@ RUN set -x \
&& cp runc /usr/local/bin/docker-runc

# Install containerd
ENV CONTAINERD_COMMIT d2f03861c91edaafdcb3961461bf82ae83785ed7
ENV CONTAINERD_COMMIT v0.2.1
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone git://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.ppc64le
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ RUN set -x \
&& rm -rf "$GOPATH"

# Install runc
ENV RUNC_COMMIT e87436998478d222be209707503c27f6f91be0c5
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \
Expand All @@ -209,7 +209,7 @@ RUN set -x \
&& cp runc /usr/local/bin/docker-runc

# Install containerd
ENV CONTAINERD_COMMIT d2f03861c91edaafdcb3961461bf82ae83785ed7
ENV CONTAINERD_COMMIT v0.2.1
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone git://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.s390x
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ RUN set -x \
&& rm -rf "$GOPATH"

# Install runc
ENV RUNC_COMMIT e87436998478d222be209707503c27f6f91be0c5
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \
Expand All @@ -188,7 +188,7 @@ RUN set -x \
&& cp runc /usr/local/bin/docker-runc

# Install containerd
ENV CONTAINERD_COMMIT d2f03861c91edaafdcb3961461bf82ae83785ed7
ENV CONTAINERD_COMMIT v0.2.1
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone git://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.simple
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

# Install runc
ENV RUNC_COMMIT e87436998478d222be209707503c27f6f91be0c5
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone git://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \
Expand All @@ -40,7 +40,7 @@ RUN set -x \
&& cp runc /usr/local/bin/docker-runc

# Install containerd
ENV CONTAINERD_COMMIT d2f03861c91edaafdcb3961461bf82ae83785ed7
ENV CONTAINERD_COMMIT v0.2.1
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone git://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" \
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.11.0
1.11.1
1 change: 1 addition & 0 deletions api/server/httputils/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func WriteError(w http.ResponseWriter, err error) {
"conflict": http.StatusConflict,
"impossible": http.StatusNotAcceptable,
"wrong login/password": http.StatusUnauthorized,
"unauthorized": http.StatusUnauthorized,
"hasn't been activated": http.StatusForbidden,
} {
if strings.Contains(errStr, keyword) {
Expand Down
21 changes: 0 additions & 21 deletions api/server/router/image/image_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import (
"fmt"
"io"
"net/http"
"net/url"
"strings"

"github.com/docker/distribution/digest"
"github.com/docker/distribution/registry/api/errcode"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/builder/dockerfile"
"github.com/docker/docker/pkg/ioutils"
Expand Down Expand Up @@ -132,12 +130,6 @@ func (s *imageRouter) postImagesCreate(ctx context.Context, w http.ResponseWrite
err = s.backend.PullImage(ctx, ref, metaHeaders, authConfig, output)
}
}
// Check the error from pulling an image to make sure the request
// was authorized. Modify the status if the request was
// unauthorized to respond with 401 rather than 500.
if err != nil && isAuthorizedError(err) {
err = errcode.ErrorCodeUnauthorized.WithMessage(fmt.Sprintf("Authentication is required: %s", err))
}
} else { //import
var newRef reference.Named
if repo != "" {
Expand Down Expand Up @@ -389,16 +381,3 @@ func (s *imageRouter) getImagesSearch(ctx context.Context, w http.ResponseWriter
}
return httputils.WriteJSON(w, http.StatusOK, query.Results)
}

func isAuthorizedError(err error) bool {
if urlError, ok := err.(*url.Error); ok {
err = urlError.Err
}

if dError, ok := err.(errcode.Error); ok {
if dError.ErrorCode() == errcode.ErrorCodeUnauthorized {
return true
}
}
return false
}
26 changes: 12 additions & 14 deletions builder/dockerfile/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,20 @@ func (b *Builder) build(config *types.ImageBuildOptions, context builder.Context
return "", err
}

if len(b.options.Labels) > 0 {
line := "LABEL "
for k, v := range b.options.Labels {
line += fmt.Sprintf("%q=%q ", k, v)
}
_, node, err := parser.ParseLine(line)
if err != nil {
return "", err
}
b.dockerfile.Children = append(b.dockerfile.Children, node)
}

var shortImgID string
for i, n := range b.dockerfile.Children {
// we only want to add labels to the last layer
if i == len(b.dockerfile.Children)-1 {
b.addLabels()
}
select {
case <-b.cancelled:
logrus.Debug("Builder: build cancelled!")
Expand All @@ -237,16 +245,6 @@ func (b *Builder) build(config *types.ImageBuildOptions, context builder.Context
return "", err
}

// Commit the layer when there are only one children in
// the dockerfile, this is only the `FROM` tag, and
// build labels. Otherwise, the new image won't be
// labeled properly.
// Commit here, so the ID of the final image is reported
// properly.
if len(b.dockerfile.Children) == 1 && len(b.options.Labels) > 0 {
b.commit("", b.runConfig.Cmd, "")
}

shortImgID = stringid.TruncateID(b.image)
fmt.Fprintf(b.Stdout, " ---> %s\n", shortImgID)
if b.options.Remove {
Expand Down
28 changes: 1 addition & 27 deletions builder/dockerfile/internals.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,6 @@ import (
"github.com/docker/engine-api/types/strslice"
)

func (b *Builder) addLabels() {
// merge labels
if len(b.options.Labels) > 0 {
logrus.Debugf("[BUILDER] setting labels %v", b.options.Labels)
if b.runConfig.Labels == nil {
b.runConfig.Labels = make(map[string]string)
}
for kL, vL := range b.options.Labels {
b.runConfig.Labels[kL] = vL
}
}
}

func (b *Builder) commit(id string, autoCmd strslice.StrSlice, comment string) error {
if b.disableCommit {
return nil
Expand Down Expand Up @@ -413,20 +400,7 @@ func (b *Builder) processImageFrom(img builder.Image) error {
b.image = img.ImageID()

if img.RunConfig() != nil {
imgConfig := *img.RunConfig()
// inherit runConfig labels from the current
// state if they've been set already.
// Ensures that images with only a FROM
// get the labels populated properly.
if b.runConfig.Labels != nil {
if imgConfig.Labels == nil {
imgConfig.Labels = make(map[string]string)
}
for k, v := range b.runConfig.Labels {
imgConfig.Labels[k] = v
}
}
b.runConfig = &imgConfig
b.runConfig = img.RunConfig()
}
}

Expand Down
2 changes: 1 addition & 1 deletion builder/dockerfile/parser/line_parsers.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func parseSubCommand(rest string) (*Node, map[string]bool, error) {
return nil, nil, nil
}

_, child, err := parseLine(rest)
_, child, err := ParseLine(rest)
if err != nil {
return nil, nil, err
}
Expand Down
10 changes: 5 additions & 5 deletions builder/dockerfile/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func init() {
}
}

// parse a line and return the remainder.
func parseLine(line string) (string, *Node, error) {
// ParseLine parse a line and return the remainder.
func ParseLine(line string) (string, *Node, error) {
if line = stripComments(line); line == "" {
return "", nil, nil
}
Expand Down Expand Up @@ -111,7 +111,7 @@ func Parse(rwc io.Reader) (*Node, error) {
for scanner.Scan() {
scannedLine := strings.TrimLeftFunc(scanner.Text(), unicode.IsSpace)
currentLine++
line, child, err := parseLine(scannedLine)
line, child, err := ParseLine(scannedLine)
if err != nil {
return nil, err
}
Expand All @@ -126,7 +126,7 @@ func Parse(rwc io.Reader) (*Node, error) {
continue
}

line, child, err = parseLine(line + newline)
line, child, err = ParseLine(line + newline)
if err != nil {
return nil, err
}
Expand All @@ -136,7 +136,7 @@ func Parse(rwc io.Reader) (*Node, error) {
}
}
if child == nil && line != "" {
_, child, err = parseLine(line)
_, child, err = ParseLine(line)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,9 @@ func copyEscapable(dst io.Writer, src io.ReadCloser, keys []byte) (written int64
return written, err
}

// ShouldRestart decides whether the daemon should restart the container or not.
// ShouldRestartOnBoot decides whether the daemon should restart the container or not.
// This is based on the container's restart policy.
func (container *Container) ShouldRestart() bool {
func (container *Container) ShouldRestartOnBoot() bool {
return container.HostConfig.RestartPolicy.Name == "always" ||
(container.HostConfig.RestartPolicy.Name == "unless-stopped" && !container.HasBeenManuallyStopped) ||
(container.HostConfig.RestartPolicy.Name == "on-failure" && container.ExitCode != 0)
Expand Down
2 changes: 1 addition & 1 deletion contrib/builder/deb/amd64/debian-jessie/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ ENV PATH $PATH:/usr/local/go/bin

ENV AUTO_GOPATH 1

ENV DOCKER_BUILDTAGS apparmor selinux
ENV DOCKER_BUILDTAGS apparmor pkcs11 selinux
ENV RUNC_BUILDTAGS apparmor selinux
2 changes: 1 addition & 1 deletion contrib/builder/deb/amd64/debian-stretch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ ENV PATH $PATH:/usr/local/go/bin

ENV AUTO_GOPATH 1

ENV DOCKER_BUILDTAGS apparmor seccomp selinux
ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux
ENV RUNC_BUILDTAGS apparmor seccomp selinux
2 changes: 1 addition & 1 deletion contrib/builder/deb/amd64/debian-wheezy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ ENV PATH $PATH:/usr/local/go/bin

ENV AUTO_GOPATH 1

ENV DOCKER_BUILDTAGS apparmor selinux
ENV DOCKER_BUILDTAGS apparmor pkcs11 selinux
ENV RUNC_BUILDTAGS apparmor selinux
2 changes: 1 addition & 1 deletion contrib/builder/deb/amd64/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ for version in "${versions[@]}"; do

echo >> "$version/Dockerfile"

extraBuildTags=
extraBuildTags='pkcs11'
runcBuildTags=

# this list is sorted alphabetically; please keep it that way
Expand Down
2 changes: 1 addition & 1 deletion contrib/builder/deb/amd64/ubuntu-precise/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ ENV PATH $PATH:/usr/local/go/bin

ENV AUTO_GOPATH 1

ENV DOCKER_BUILDTAGS apparmor exclude_graphdriver_btrfs exclude_graphdriver_devicemapper selinux
ENV DOCKER_BUILDTAGS apparmor exclude_graphdriver_btrfs exclude_graphdriver_devicemapper pkcs11 selinux
ENV RUNC_BUILDTAGS apparmor selinux
2 changes: 1 addition & 1 deletion contrib/builder/deb/amd64/ubuntu-trusty/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ ENV PATH $PATH:/usr/local/go/bin

ENV AUTO_GOPATH 1

ENV DOCKER_BUILDTAGS apparmor selinux
ENV DOCKER_BUILDTAGS apparmor pkcs11 selinux
ENV RUNC_BUILDTAGS apparmor selinux
2 changes: 1 addition & 1 deletion contrib/builder/deb/amd64/ubuntu-wily/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ ENV PATH $PATH:/usr/local/go/bin

ENV AUTO_GOPATH 1

ENV DOCKER_BUILDTAGS apparmor seccomp selinux
ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux
ENV RUNC_BUILDTAGS apparmor seccomp selinux
2 changes: 1 addition & 1 deletion contrib/builder/deb/amd64/ubuntu-xenial/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ ENV PATH $PATH:/usr/local/go/bin

ENV AUTO_GOPATH 1

ENV DOCKER_BUILDTAGS apparmor seccomp selinux
ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux
ENV RUNC_BUILDTAGS apparmor seccomp selinux
2 changes: 1 addition & 1 deletion contrib/builder/rpm/amd64/centos-7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ ENV PATH $PATH:/usr/local/go/bin

ENV AUTO_GOPATH 1

ENV DOCKER_BUILDTAGS selinux
ENV DOCKER_BUILDTAGS pkcs11 selinux
ENV RUNC_BUILDTAGS selinux

2 changes: 1 addition & 1 deletion contrib/builder/rpm/amd64/fedora-22/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ ENV PATH $PATH:/usr/local/go/bin

ENV AUTO_GOPATH 1

ENV DOCKER_BUILDTAGS seccomp selinux
ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux
ENV RUNC_BUILDTAGS seccomp selinux

Loading

0 comments on commit 7ef1cfd

Please sign in to comment.