Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: moby/moby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v23.0.3
Choose a base ref
...
head repository: moby/moby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v23.0.4
Choose a head ref

Commits on Mar 28, 2023

  1. integration-cli: Enable TestExecStartFails on Windows

    Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
    (cherry picked from commit be34e93)
    Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
    vvoland committed Mar 28, 2023
    Copy the full SHA
    f3946c1 View commit details

Commits on Mar 30, 2023

  1. update runc binary to v1.1.5

    release notes: https://github.com/opencontainers/runc/releases/tag/v1.1.5
    diff: opencontainers/runc@v1.1.4...v1.1.5
    
    This is the fifth patch release in the 1.1.z series of runc, which fixes
    three CVEs found in runc.
    
    * CVE-2023-25809 is a vulnerability involving rootless containers where
      (under specific configurations), the container would have write access
      to the /sys/fs/cgroup/user.slice/... cgroup hierarchy. No other
      hierarchies on the host were affected. This vulnerability was
      discovered by Akihiro Suda.
      <GHSA-m8cg-xc2p-r3fc>
    
    * CVE-2023-27561 was a regression which effectively re-introduced
      CVE-2019-19921. This bug was present from v1.0.0-rc95 to v1.1.4. This
      regression was discovered by @Beuc.
      <GHSA-vpvm-3wq2-2wvm>
    
    * CVE-2023-28642 is a variant of CVE-2023-27561 and was fixed by the same
      patch. This variant of the above vulnerability was reported by Lei
      Wang.
      <GHSA-g2j6-57v7-gm8c>
    
    In addition, the following other fixes are included in this release:
    
    * Fix the inability to use `/dev/null` when inside a container.
    * Fix changing the ownership of host's `/dev/null` caused by fd redirection
      (a regression in 1.1.1).
    * Fix rare runc exec/enter unshare error on older kernels, including
      CentOS < 7.7.
    * nsexec: Check for errors in `write_log()`.
    
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    (cherry picked from commit 77be7b7)
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    thaJeztah committed Mar 30, 2023
    Copy the full SHA
    3923e30 View commit details
  2. libnet/d/windows: log EnableInternalDNS val after setting it

    Signed-off-by: Albin Kerouanton <albinker@gmail.com>
    (cherry picked from commit bae49ff)
    Signed-off-by: Albin Kerouanton <albinker@gmail.com>
    akerouanton committed Mar 30, 2023
    Copy the full SHA
    348544e View commit details
  3. update containerd binary to v1.6.20

    Notable Updates
    
    - Disable looking up usernames and groupnames on host
    - Add support for Windows ArgsEscaped images
    - Update hcsshim to v0.9.8
    - Fix debug flag in shim
    - Add WithReadonlyTempMount to support readonly temporary mounts
    - Update ttrpc to fix file descriptor leak
    - Update runc binary to v1.1.5
    = Update image config to support ArgsEscaped
    
    full diff: containerd/containerd@v1.6.19...v1.6.20
    
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    thaJeztah committed Mar 30, 2023
    Copy the full SHA
    389e180 View commit details

Commits on Mar 31, 2023

  1. daemon: let libnetwork assign default bridge IPAM

    The netutils.ElectInterfaceAddresses function is only used in one place
    outside of tests: in the daemon, to configure the default bridge
    network. The function is also messy to reason about as it references the
    shared mutable state of ipamutils.PredefinedLocalScopeDefaultNetworks.
    It uses the list of predefined default networks to always return an IPv4
    address even if the named interface does not exist or does not have any
    IPv4 addresses. This list happens to be the same as the one used to
    initialize the address pool of the 'builtin' IPAM driver, though that is
    far from obvious. (Start with "./libnetwork".initIPAMDrivers and trace
    the dataflow of the addressPool value. Surprise! Global state is being
    mutated using the value of other global mutable state.)
    
    The daemon does not need the fallback behaviour of
    ElectInterfaceAddresses. In fact, the daemon does not have to configure
    an address pool for the network at all! libnetwork will acquire one of
    the available address ranges from the network's IPAM driver when the
    preferred-pool configuration is unset. It will do so using the same list
    of address ranges and the exact same logic
    (netutils.FindAvailableNetworks) as ElectInterfaceAddresses. So unless
    the daemon needs to force the network to use a specific address range
    because the bridge interface already exists, it can leave the details
    up to libnetwork.
    
    Signed-off-by: Cory Snider <csnider@mirantis.com>
    (cherry picked from commit cc19eba)
    Signed-off-by: Albin Kerouanton <albinker@gmail.com>
    corhere authored and akerouanton committed Mar 31, 2023
    Copy the full SHA
    063d3a6 View commit details

Commits on Apr 5, 2023

  1. Merge pull request #45246 from akerouanton/cherrypick-44827

    [23.0 backport] daemon: let libnetwork assign default bridge IPAM
    thaJeztah authored Apr 5, 2023
    Copy the full SHA
    15d6037 View commit details
  2. Merge pull request #45245 from thaJeztah/23.0_containerd_binary_1.6.20

    [23.0] update containerd binary to v1.6.20
    thaJeztah authored Apr 5, 2023
    Copy the full SHA
    aaa102b View commit details
  3. Merge pull request #45240 from akerouanton/cherrypick-45211

    [23.0 backport] libnet/d/windows: log EnableInternalDNS val after setting it
    thaJeztah authored Apr 5, 2023
    Copy the full SHA
    3648a49 View commit details
  4. Merge pull request #45237 from thaJeztah/23.0_backport_update_runc_bi…

    …nary_1.1.5
    
    [23.0 backport] update runc binary to v1.1.5
    thaJeztah authored Apr 5, 2023
    Copy the full SHA
    0ce1e22 View commit details
  5. Merge pull request #45220 from vvoland/test-windows-execstartfails-23

    [23.0 backport] integration-cli: Enable TestExecStartFails on Windows
    thaJeztah authored Apr 5, 2023
    Copy the full SHA
    c9f6343 View commit details
  6. [23.0] fix vendor.mod: add hashicorp/go-multierror as direct dependency

    commit 59118bf made this a direct
    dependency (previously it was indirect). That commit was part of an
    advisory, and didn't run the vendor validation check because of that.
    
    This patch fixes the vendor.mod to unblock CI in this branch.
    
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    thaJeztah committed Apr 5, 2023
    Copy the full SHA
    a0a597c View commit details
  7. Merge pull request #45279 from thaJeztah/23.0_fix_vendor

    [23.0] fix vendor.mod: add hashicorp/go-multierror as direct dependency
    thaJeztah authored Apr 5, 2023
    Copy the full SHA
    347bce4 View commit details
  8. [23.0] update go to go1.19.8

    go1.19.8 (released 2023-04-04) includes security fixes to the go/parser,
    html/template, mime/multipart, net/http, and net/textproto packages, as well as
    bug fixes to the linker, the runtime, and the time package. See the Go 1.19.8
    milestone on our issue tracker for details:
    
    https://github.com/golang/go/issues?q=milestone%3AGo1.19.8+label%3ACherryPickApproved
    
    full diff: golang/go@go1.19.7...go1.19.8
    
    Further details from the announcement on the mailing list:
    
    We have just released Go versions 1.20.3 and 1.19.8, minor point releases.
    These minor releases include 4 security fixes following the security policy:
    
    - go/parser: infinite loop in parsing
    
      Calling any of the Parse functions on Go source code which contains `//line`
      directives with very large line numbers can cause an infinite loop due to
      integer overflow.
      Thanks to Philippe Antoine (Catena cyber) for reporting this issue.
      This is CVE-2023-24537 and Go issue https://go.dev/issue/59180.
    
    - html/template: backticks not treated as string delimiters
    
      Templates did not properly consider backticks (`) as Javascript string
      delimiters, and as such did not escape them as expected. Backticks are
      used, since ES6, for JS template literals. If a template contained a Go
      template action within a Javascript template literal, the contents of the
      action could be used to terminate the literal, injecting arbitrary Javascript
      code into the Go template.
    
      As ES6 template literals are rather complex, and themselves can do string
      interpolation, we've decided to simply disallow Go template actions from being
      used inside of them (e.g. "var a = {{.}}"), since there is no obviously safe
      way to allow this behavior. This takes the same approach as
      github.com/google/safehtml. Template.Parse will now return an Error when it
      encounters templates like this, with a currently unexported ErrorCode with a
      value of 12. This ErrorCode will be exported in the next major release.
    
      Users who rely on this behavior can re-enable it using the GODEBUG flag
      jstmpllitinterp=1, with the caveat that backticks will now be escaped. This
      should be used with caution.
    
      Thanks to Sohom Datta, Manipal Institute of Technology, for reporting this issue.
    
      This is CVE-2023-24538 and Go issue https://go.dev/issue/59234.
    
    - net/http, net/textproto: denial of service from excessive memory allocation
    
      HTTP and MIME header parsing could allocate large amounts of memory, even when
      parsing small inputs.
    
      Certain unusual patterns of input data could cause the common function used to
      parse HTTP and MIME headers to allocate substantially more memory than
      required to hold the parsed headers. An attacker can exploit this behavior to
      cause an HTTP server to allocate large amounts of memory from a small request,
      potentially leading to memory exhaustion and a denial of service.
      Header parsing now correctly allocates only the memory required to hold parsed
      headers.
    
      Thanks to Jakob Ackermann (@das7pad) for discovering this issue.
    
      This is CVE-2023-24534 and Go issue https://go.dev/issue/58975.
    
    - net/http, net/textproto, mime/multipart: denial of service from excessive resource consumption
    
      Multipart form parsing can consume large amounts of CPU and memory when
      processing form inputs containing very large numbers of parts. This stems from
      several causes:
    
      mime/multipart.Reader.ReadForm limits the total memory a parsed multipart form
      can consume. ReadForm could undercount the amount of memory consumed, leading
      it to accept larger inputs than intended. Limiting total memory does not
      account for increased pressure on the garbage collector from large numbers of
      small allocations in forms with many parts. ReadForm could allocate a large
      number of short-lived buffers, further increasing pressure on the garbage
      collector. The combination of these factors can permit an attacker to cause an
      program that parses multipart forms to consume large amounts of CPU and
      memory, potentially resulting in a denial of service. This affects programs
      that use mime/multipart.Reader.ReadForm, as well as form parsing in the
      net/http package with the Request methods FormFile, FormValue,
      ParseMultipartForm, and PostFormValue.
    
      ReadForm now does a better job of estimating the memory consumption of parsed
      forms, and performs many fewer short-lived allocations.
    
      In addition, mime/multipart.Reader now imposes the following limits on the
      size of parsed forms:
    
      Forms parsed with ReadForm may contain no more than 1000 parts. This limit may
      be adjusted with the environment variable GODEBUG=multipartmaxparts=. Form
      parts parsed with NextPart and NextRawPart may contain no more than 10,000
      header fields. In addition, forms parsed with ReadForm may contain no more
      than 10,000 header fields across all parts. This limit may be adjusted with
      the environment variable GODEBUG=multipartmaxheaders=.
    
      Thanks to Jakob Ackermann for discovering this issue.
    
      This is CVE-2023-24536 and Go issue https://go.dev/issue/59153.
    
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    thaJeztah committed Apr 5, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d3e5293 View commit details
  9. Merge pull request #45277 from thaJeztah/23.0_bump_go1.19.8

    [23.0] update go to go1.19.8
    thaJeztah authored Apr 5, 2023
    Copy the full SHA
    4ca4705 View commit details

Commits on Apr 7, 2023

  1. docker-rootless-setuptools.sh: improve readability of messages

    Before:
    ```console
    $ docker-rootless-setuptool.sh install
    ...
    [INFO] Use CLI context "rootless"
    Current context is now "rootless"
    
    [INFO] Make sure the following environment variables are set (or add them to ~/.bashrc):
    
    export PATH=/usr/local/bin:$PATH
    Some applications may require the following environment variable too:
    export DOCKER_HOST=unix:///run/user/1001/docker.sock
    ```
    
    After:
    ```console
    $ docker-rootless-setuptool.sh install
    ...
    [INFO] Using CLI context "rootless"
    Current context is now "rootless"
    
    [INFO] Make sure the following environment variable(s) are set (or add them to ~/.bashrc):
    export PATH=/usr/local/bin:$PATH
    
    [INFO] Some applications may require the following environment variable too:
    export DOCKER_HOST=unix:///run/user/1001/docker.sock
    ```
    
    Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
    (cherry picked from commit 4aa2876)
    Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
    AkihiroSuda committed Apr 7, 2023
    Copy the full SHA
    09fbbd5 View commit details

Commits on Apr 12, 2023

  1. Merge pull request #45293 from AkihiroSuda/backport-45283-23

    [23.0 backport] docker-rootless-setuptools.sh: improve readability of messages
    thaJeztah authored Apr 12, 2023
    Copy the full SHA
    cdb6200 View commit details

Commits on Apr 13, 2023

  1. vendor: github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2

    - Prevent from descriptor leak
    - Fixes optlen in getsockopt() for s390x
    
    full diff: ishidawataru/sctp@9a39160...7ff4192
    
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    (cherry picked from commit 893d284)
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    thaJeztah committed Apr 13, 2023
    Copy the full SHA
    9277e64 View commit details
  2. Merge pull request #45323 from thaJeztah/23.0_backport_vendor_sctp

    [23.0 backport] vendor: github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2
    thaJeztah authored Apr 13, 2023
    Copy the full SHA
    90e8a0b View commit details
  3. vendor: github.com/moby/buildkit v0.10.7-0.20230412161310-d52b2d584242

    Signed-off-by: Kevin Gentile <kevin.gentile@rockwellautomation.com>
    kevingentile authored and thaJeztah committed Apr 13, 2023
    Copy the full SHA
    23774ad View commit details
  4. Fix argument quoting bugs in dockerd-rootless.sh

    Signed-off-by: kpcyrd <git@rxv.cc>
    (cherry picked from commit 7fe0f73)
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    kpcyrd authored and thaJeztah committed Apr 13, 2023
    Copy the full SHA
    3731ce1 View commit details

Commits on Apr 14, 2023

  1. Merge pull request #45331 from thaJeztah/23.0_backport_rootless_scrip…

    …t_bugs
    
    [23.0 backport] Fix argument quoting bugs in dockerd-rootless.sh
    neersighted authored Apr 14, 2023
    Copy the full SHA
    5f684cb View commit details
  2. Merge pull request #45330 from kevingentile/buildkit-3770

    [23.0] vendor: github.com/moby/buildkit v0.10.7-0.20230412161310-d52b2d584242
    thaJeztah authored Apr 14, 2023
    Copy the full SHA
    cbce331 View commit details
2 changes: 1 addition & 1 deletion .github/workflows/.windows.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ on:
default: false

env:
GO_VERSION: 1.19.7
GO_VERSION: 1.19.8
GOTESTLIST_VERSION: v0.3.1
TESTSTAT_VERSION: v0.1.3
WINDOWS_BASE_IMAGE: mcr.microsoft.com/windows/servercore
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ on:
pull_request:

env:
GO_VERSION: 1.19.7
GO_VERSION: 1.19.8
GOTESTLIST_VERSION: v0.3.1
TESTSTAT_VERSION: v0.1.3
ITG_CLI_MATRIX_SIZE: 6
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

ARG GO_VERSION=1.19.7
ARG GO_VERSION=1.19.8
ARG BASE_DEBIAN_DISTRO="bullseye"
ARG GOLANG_IMAGE="golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO}"
ARG XX_VERSION=1.1.2
@@ -192,7 +192,7 @@ RUN git init . && git remote add origin "https://github.com/containerd/container
# When updating the binary version you may also need to update the vendor
# version to pick up bug fixes or new APIs, however, usually the Go packages
# are built from a commit from the master branch.
ARG CONTAINERD_VERSION=v1.6.19
ARG CONTAINERD_VERSION=v1.6.20
RUN git fetch -q --depth 1 origin "${CONTAINERD_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD

FROM base AS containerd-build
@@ -280,7 +280,7 @@ RUN git init . && git remote add origin "https://github.com/opencontainers/runc.
# that is used. If you need to update runc, open a pull request in the containerd
# project first, and update both after that is merged. When updating RUNC_VERSION,
# consider updating runc in vendor.mod accordingly.
ARG RUNC_VERSION=v1.1.4
ARG RUNC_VERSION=v1.1.5
RUN git fetch -q --depth 1 origin "${RUNC_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD

FROM base AS runc-build
2 changes: 1 addition & 1 deletion Dockerfile.e2e
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GO_VERSION=1.19.7
ARG GO_VERSION=1.19.8

FROM golang:${GO_VERSION}-alpine AS base
ENV GO111MODULE=off
2 changes: 1 addition & 1 deletion Dockerfile.simple
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

# This represents the bare minimum required to build and test Docker.

ARG GO_VERSION=1.19.7
ARG GO_VERSION=1.19.8

ARG BASE_DEBIAN_DISTRO="bullseye"
ARG GOLANG_IMAGE="golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO}"
4 changes: 2 additions & 2 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -165,10 +165,10 @@ FROM microsoft/windowsservercore
# Use PowerShell as the default shell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

ARG GO_VERSION=1.19.7
ARG GO_VERSION=1.19.8
ARG GOTESTSUM_VERSION=v1.8.2
ARG GOWINRES_VERSION=v0.3.0
ARG CONTAINERD_VERSION=v1.6.19
ARG CONTAINERD_VERSION=v1.6.20

# Environment variable notes:
# - GO_VERSION must be consistent with 'Dockerfile' used by Linux.
10 changes: 5 additions & 5 deletions contrib/dockerd-rootless-setuptool.sh
Original file line number Diff line number Diff line change
@@ -390,18 +390,18 @@ cmd_entrypoint_install() {
cli_ctx_create "${CLI_CONTEXT}" "unix://${XDG_RUNTIME_DIR}/docker.sock" "Rootless mode"
fi

INFO "Use CLI context \"${CLI_CONTEXT}\""
INFO "Using CLI context \"${CLI_CONTEXT}\""
cli_ctx_use "${CLI_CONTEXT}"

echo
INFO "Make sure the following environment variables are set (or add them to ~/.bashrc):"
echo
INFO "Make sure the following environment variable(s) are set (or add them to ~/.bashrc):"
if [ -n "$XDG_RUNTIME_DIR_CREATED" ]; then
echo "# WARNING: systemd not found. You have to remove XDG_RUNTIME_DIR manually on every logout."
echo "export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR}"
fi
echo "export PATH=${BIN}:\$PATH"
echo "Some applications may require the following environment variable too:"
echo
INFO "Some applications may require the following environment variable too:"
echo "export DOCKER_HOST=unix://${XDG_RUNTIME_DIR}/docker.sock"
echo

@@ -433,7 +433,7 @@ cmd_entrypoint_uninstall() {
unset DOCKER_HOST
unset DOCKER_CONTEXT
cli_ctx_use "default"
INFO 'Configured CLI use the "default" context.'
INFO 'Configured CLI to use the "default" context.'
INFO
INFO 'Make sure to unset or update the environment PATH, DOCKER_HOST, and DOCKER_CONTEXT environment variables if you have added them to `~/.bashrc`.'
INFO "This uninstallation tool does NOT remove Docker binaries and data."
5 changes: 2 additions & 3 deletions contrib/dockerd-rootless.sh
Original file line number Diff line number Diff line change
@@ -107,7 +107,7 @@ if [ -z "$_DOCKERD_ROOTLESS_CHILD" ]; then
--copy-up=/etc --copy-up=/run \
--propagation=rslave \
$DOCKERD_ROOTLESS_ROOTLESSKIT_FLAGS \
$0 $@
"$0" "$@"
else
[ "$_DOCKERD_ROOTLESS_CHILD" = 1 ]
# remove the symlinks for the existing files in the parent namespace if any,
@@ -130,6 +130,5 @@ else
mount --rbind ${realpath_etc_ssl} /etc/ssl
fi

# shellcheck disable=SC2086
exec $dockerd "$@"
exec "$dockerd" "$@"
fi
41 changes: 41 additions & 0 deletions daemon/daemon_linux.go
Original file line number Diff line number Diff line change
@@ -4,16 +4,19 @@ import (
"bufio"
"fmt"
"io"
"net"
"os"
"regexp"
"strings"

"github.com/docker/docker/daemon/config"
"github.com/docker/docker/libnetwork/ns"
"github.com/docker/docker/libnetwork/resolvconf"
"github.com/moby/sys/mount"
"github.com/moby/sys/mountinfo"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/vishvananda/netlink"
)

// On Linux, plugins use a static path for storing execution state,
@@ -141,3 +144,41 @@ func setupResolvConf(config *config.Config) {
}
config.ResolvConf = resolvconf.Path()
}

// ifaceAddrs returns the IPv4 and IPv6 addresses assigned to the network
// interface with name linkName.
//
// No error is returned if the named interface does not exist.
func ifaceAddrs(linkName string) (v4, v6 []*net.IPNet, err error) {
nl := ns.NlHandle()
link, err := nl.LinkByName(linkName)
if err != nil {
if !errors.As(err, new(netlink.LinkNotFoundError)) {
return nil, nil, err
}
return nil, nil, nil
}

get := func(family int) ([]*net.IPNet, error) {
addrs, err := nl.AddrList(link, family)
if err != nil {
return nil, err
}

ipnets := make([]*net.IPNet, len(addrs))
for i := range addrs {
ipnets[i] = addrs[i].IPNet
}
return ipnets, nil
}

v4, err = get(netlink.FAMILY_V4)
if err != nil {
return nil, nil, err
}
v6, err = get(netlink.FAMILY_V6)
if err != nil {
return nil, nil, err
}
return v4, v6, nil
}
68 changes: 68 additions & 0 deletions daemon/daemon_linux_test.go
Original file line number Diff line number Diff line change
@@ -4,15 +4,20 @@
package daemon // import "github.com/docker/docker/daemon"

import (
"net"
"os"
"path/filepath"
"strings"
"testing"

containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/daemon/config"
"github.com/docker/docker/libnetwork/testutils"
"github.com/docker/docker/libnetwork/types"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/moby/sys/mount"
"github.com/moby/sys/mountinfo"
"github.com/vishvananda/netlink"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
@@ -343,3 +348,66 @@ func TestRootMountCleanup(t *testing.T) {
assert.Assert(t, d.cleanupMounts())
})
}

func TestIfaceAddrs(t *testing.T) {
CIDR := func(cidr string) *net.IPNet {
t.Helper()
nw, err := types.ParseCIDR(cidr)
assert.NilError(t, err)
return nw
}

for _, tt := range []struct {
name string
nws []*net.IPNet
}{
{
name: "Single",
nws: []*net.IPNet{CIDR("172.101.202.254/16")},
},
{
name: "Multiple",
nws: []*net.IPNet{
CIDR("172.101.202.254/16"),
CIDR("172.102.202.254/16"),
},
},
} {
t.Run(tt.name, func(t *testing.T) {
defer testutils.SetupTestOSContext(t)()

createBridge(t, "test", tt.nws...)

ipv4Nw, ipv6Nw, err := ifaceAddrs("test")
if err != nil {
t.Fatal(err)
}

assert.Check(t, is.DeepEqual(tt.nws, ipv4Nw,
cmpopts.SortSlices(func(a, b *net.IPNet) bool { return a.String() < b.String() })))
// IPv6 link-local address
assert.Check(t, is.Len(ipv6Nw, 1))
})
}
}

func createBridge(t *testing.T, name string, bips ...*net.IPNet) {
t.Helper()

link := &netlink.Bridge{
LinkAttrs: netlink.LinkAttrs{
Name: name,
},
}
if err := netlink.LinkAdd(link); err != nil {
t.Fatalf("Failed to create interface via netlink: %v", err)
}
for _, bip := range bips {
if err := netlink.AddrAdd(link, &netlink.Addr{IPNet: bip}); err != nil {
t.Fatal(err)
}
}
if err := netlink.LinkSetUp(link); err != nil {
t.Fatal(err)
}
}
42 changes: 24 additions & 18 deletions daemon/daemon_unix.go
Original file line number Diff line number Diff line change
@@ -34,7 +34,6 @@ import (
nwconfig "github.com/docker/docker/libnetwork/config"
"github.com/docker/docker/libnetwork/drivers/bridge"
"github.com/docker/docker/libnetwork/netlabel"
"github.com/docker/docker/libnetwork/netutils"
"github.com/docker/docker/libnetwork/options"
lntypes "github.com/docker/docker/libnetwork/types"
"github.com/docker/docker/opts"
@@ -950,30 +949,37 @@ func initBridgeDriver(controller libnetwork.NetworkController, config *config.Co

ipamV4Conf := &libnetwork.IpamConf{AuxAddresses: make(map[string]string)}

nwList, nw6List, err := netutils.ElectInterfaceAddresses(bridgeName)
// By default, libnetwork will request an arbitrary available address
// pool for the network from the configured IPAM allocator.
// Configure it to use the IPv4 network ranges of the existing bridge
// interface if one exists with IPv4 addresses assigned to it.

nwList, nw6List, err := ifaceAddrs(bridgeName)
if err != nil {
return errors.Wrap(err, "list bridge addresses failed")
}

nw := nwList[0]
if len(nwList) > 1 && config.BridgeConfig.FixedCIDR != "" {
_, fCIDR, err := net.ParseCIDR(config.BridgeConfig.FixedCIDR)
if err != nil {
return errors.Wrap(err, "parse CIDR failed")
}
// Iterate through in case there are multiple addresses for the bridge
for _, entry := range nwList {
if fCIDR.Contains(entry.IP) {
nw = entry
break
if len(nwList) > 0 {
nw := nwList[0]
if len(nwList) > 1 && config.BridgeConfig.FixedCIDR != "" {
_, fCIDR, err := net.ParseCIDR(config.BridgeConfig.FixedCIDR)
if err != nil {
return errors.Wrap(err, "parse CIDR failed")
}
// Iterate through in case there are multiple addresses for the bridge
for _, entry := range nwList {
if fCIDR.Contains(entry.IP) {
nw = entry
break
}
}
}
}

ipamV4Conf.PreferredPool = lntypes.GetIPNetCanonical(nw).String()
hip, _ := lntypes.GetHostPartIP(nw.IP, nw.Mask)
if hip.IsGlobalUnicast() {
ipamV4Conf.Gateway = nw.IP.String()
ipamV4Conf.PreferredPool = lntypes.GetIPNetCanonical(nw).String()
hip, _ := lntypes.GetHostPartIP(nw.IP, nw.Mask)
if hip.IsGlobalUnicast() {
ipamV4Conf.Gateway = nw.IP.String()
}
}

if config.BridgeConfig.IP != "" {
2 changes: 1 addition & 1 deletion hack/dockerfile/install/containerd.installer
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ set -e
# the binary version you may also need to update the vendor version to pick up
# bug fixes or new APIs, however, usually the Go packages are built from a
# commit from the master branch.
: "${CONTAINERD_VERSION:=v1.6.19}"
: "${CONTAINERD_VERSION:=v1.6.20}"

install_containerd() (
echo "Install containerd version $CONTAINERD_VERSION"
2 changes: 1 addition & 1 deletion hack/dockerfile/install/runc.installer
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ set -e
# the containerd project first, and update both after that is merged.
#
# When updating RUNC_VERSION, consider updating runc in vendor.mod accordingly
: "${RUNC_VERSION:=v1.1.4}"
: "${RUNC_VERSION:=v1.1.5}"

install_runc() {
RUNC_BUILDTAGS="${RUNC_BUILDTAGS:-"seccomp"}"
10 changes: 6 additions & 4 deletions integration-cli/docker_cli_exec_test.go
Original file line number Diff line number Diff line change
@@ -509,16 +509,18 @@ func (s *DockerCLIExecSuite) TestExecUlimits(c *testing.T) {

// #15750
func (s *DockerCLIExecSuite) TestExecStartFails(c *testing.T) {
// TODO Windows CI. This test should be portable. Figure out why it fails
// currently.
testRequires(c, DaemonIsLinux)
name := "exec-15750"
runSleepingContainer(c, "-d", "--name", name)
assert.NilError(c, waitRun(name))

out, _, err := dockerCmdWithError("exec", name, "no-such-cmd")
assert.ErrorContains(c, err, "", out)
assert.Assert(c, strings.Contains(out, "executable file not found"))

expectedMsg := "executable file not found"
if DaemonIsWindows() {
expectedMsg = "The system cannot find the file specified"
}
assert.Assert(c, is.Contains(out, expectedMsg))
}

// Fix regression in https://github.com/docker/docker/pull/26461#issuecomment-250287297
2 changes: 1 addition & 1 deletion libnetwork/drivers/windows/windows.go
Original file line number Diff line number Diff line change
@@ -681,8 +681,8 @@ func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo,
}

if n.driver.name == "nat" && !epOption.DisableDNS {
logrus.Debugf("endpointStruct.EnableInternalDNS =[%v]", endpointStruct.EnableInternalDNS)
endpointStruct.EnableInternalDNS = true
logrus.Debugf("endpointStruct.EnableInternalDNS =[%v]", endpointStruct.EnableInternalDNS)
}

endpointStruct.DisableICC = epOption.DisableICC
6 changes: 3 additions & 3 deletions vendor.mod
Original file line number Diff line number Diff line change
@@ -42,14 +42,15 @@ require (
github.com/gorilla/mux v1.8.0
github.com/hashicorp/go-immutable-radix v1.3.1
github.com/hashicorp/go-memdb v1.3.2
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/memberlist v0.4.0
github.com/hashicorp/serf v0.8.5
github.com/imdario/mergo v0.3.12
github.com/ishidawataru/sctp v0.0.0-20210707070123-9a39160e9062
github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2
github.com/klauspost/compress v1.15.12
github.com/miekg/dns v1.1.43
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible
github.com/moby/buildkit v0.10.7-0.20230306143919-70f2ad56d3e5
github.com/moby/buildkit v0.10.7-0.20230412161310-d52b2d584242
github.com/moby/ipvs v1.1.0
github.com/moby/locker v1.0.1
github.com/moby/patternmatcher v0.5.0
@@ -125,7 +126,6 @@ require (
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-msgpack v0.5.5 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
8 changes: 4 additions & 4 deletions vendor.sum
Original file line number Diff line number Diff line change
@@ -644,8 +644,8 @@ github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/ishidawataru/sctp v0.0.0-20210707070123-9a39160e9062 h1:G1+wBT0dwjIrBdLy0MIG0i+E4CQxEnedHXdauJEIH6g=
github.com/ishidawataru/sctp v0.0.0-20210707070123-9a39160e9062/go.mod h1:co9pwDoBCm1kGxawmb4sPq0cSIOOWNPT4KnHotMP1Zg=
github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2 h1:i2fYnDurfLlJH8AyyMOnkLHnHeP8Ff/DDpuZA/D3bPo=
github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2/go.mod h1:co9pwDoBCm1kGxawmb4sPq0cSIOOWNPT4KnHotMP1Zg=
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA=
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
@@ -728,8 +728,8 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A=
github.com/moby/buildkit v0.10.7-0.20230306143919-70f2ad56d3e5 h1:1CEKLCfx4WEWbP4A+cI61IR6pC5h6cAN+20CXsU7NRU=
github.com/moby/buildkit v0.10.7-0.20230306143919-70f2ad56d3e5/go.mod h1:tQuuyTWtOb9D+RE425cwOCUkX0/oZ+5iBZ+uWpWQ9bU=
github.com/moby/buildkit v0.10.7-0.20230412161310-d52b2d584242 h1:YEWromfSEDvSx13xK7jZwoNTNnYEgpguSpedsXpZ6PA=
github.com/moby/buildkit v0.10.7-0.20230412161310-d52b2d584242/go.mod h1:tQuuyTWtOb9D+RE425cwOCUkX0/oZ+5iBZ+uWpWQ9bU=
github.com/moby/ipvs v1.1.0 h1:ONN4pGaZQgAx+1Scz5RvWV4Q7Gb+mvfRh3NsPS+1XQQ=
github.com/moby/ipvs v1.1.0/go.mod h1:4VJMWuf098bsUMmZEiD4Tjk/O7mOn3l1PTD3s4OoYAs=
github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=
6 changes: 5 additions & 1 deletion vendor/github.com/ishidawataru/sctp/sctp_linux.go
9 changes: 8 additions & 1 deletion vendor/github.com/moby/buildkit/cache/manager.go
11 changes: 11 additions & 0 deletions vendor/github.com/moby/buildkit/cache/opts.go
11 changes: 10 additions & 1 deletion vendor/github.com/moby/buildkit/cache/remotecache/local/local.go
13 changes: 13 additions & 0 deletions vendor/github.com/moby/buildkit/executor/oci/user.go
21 changes: 21 additions & 0 deletions vendor/github.com/moby/buildkit/util/contentutil/multiprovider.go
4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -459,7 +459,7 @@ github.com/imdario/mergo
# github.com/inconshreveable/mousetrap v1.0.1
## explicit; go 1.18
github.com/inconshreveable/mousetrap
# github.com/ishidawataru/sctp v0.0.0-20210707070123-9a39160e9062
# github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2
## explicit; go 1.12
github.com/ishidawataru/sctp
# github.com/jmespath/go-jmespath v0.4.0
@@ -486,7 +486,7 @@ github.com/mistifyio/go-zfs
# github.com/mitchellh/hashstructure/v2 v2.0.2
## explicit; go 1.14
github.com/mitchellh/hashstructure/v2
# github.com/moby/buildkit v0.10.7-0.20230306143919-70f2ad56d3e5
# github.com/moby/buildkit v0.10.7-0.20230412161310-d52b2d584242
## explicit; go 1.17
github.com/moby/buildkit/api/services/control
github.com/moby/buildkit/api/types