Skip to content

Commit

Permalink
Merge pull request #2277 from weaveworks/2276-use-recent-client-as-1.10
Browse files Browse the repository at this point in the history
Embed Docker 1.13.1 (but force protocol 1.22)
  • Loading branch information
Alfonso Acosta authored Feb 24, 2017
2 parents bc1c964 + f892cb1 commit 0ebc0b9
Show file tree
Hide file tree
Showing 339 changed files with 139,302 additions and 5,799 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ scope.tar
prog/scope
docker/scope
docker/docker.tgz
docker/docker
docker/weave
docker/weaveutil
docker/runsvinit
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SCOPE_BACKEND_BUILD_IMAGE=$(DOCKERHUB_USER)/scope-backend-build
SCOPE_BACKEND_BUILD_UPTODATE=.scope_backend_build.uptodate
SCOPE_VERSION=$(shell git rev-parse --short HEAD)
WEAVENET_VERSION=1.9.0
DOCKER_VERSION=1.10.3
DOCKER_VERSION=1.13.1
DOCKER_DISTRIB=.pkg/docker-$(DOCKER_VERSION).tgz
DOCKER_DISTRIB_URL=https://get.docker.com/builds/Linux/x86_64/docker-$(DOCKER_VERSION).tgz
RUNSVINIT=vendor/runsvinit/runsvinit
Expand Down Expand Up @@ -49,6 +49,7 @@ docker/weaveutil:
$(SCOPE_EXPORT): $(SCOPE_EXE) $(DOCKER_DISTRIB) docker/weave docker/weaveutil $(RUNSVINIT) docker/Dockerfile docker/demo.json docker/run-app docker/run-probe docker/entrypoint.sh
cp $(SCOPE_EXE) $(RUNSVINIT) docker/
cp $(DOCKER_DISTRIB) docker/docker.tgz
tar -xvzf docker/docker.tgz docker/docker
$(SUDO) docker build -t $(SCOPE_IMAGE) docker/
$(SUDO) docker tag $(SCOPE_IMAGE) $(SCOPE_IMAGE):$(IMAGE_TAG)
$(SUDO) docker save $(SCOPE_IMAGE):latest > $@
Expand Down
15 changes: 12 additions & 3 deletions common/weave/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net"
"net/http"
"net/url"
"os"
"regexp"
"strconv"

Expand All @@ -15,6 +16,8 @@ import (
"github.com/weaveworks/common/exec"
)

const dockerAPIVersion = "1.22" // Support Docker Engine >= 1.10

// Client for Weave Net API
type Client interface {
Status() (Status, error)
Expand Down Expand Up @@ -160,7 +163,7 @@ func (c *client) AddDNSEntry(fqdn, containerID string, ip net.IP) error {
}

func (c *client) PS() (map[string]PSEntry, error) {
cmd := exec.Command("weave", "--local", "ps")
cmd := weaveCommand("--local", "ps")
out, err := cmd.StdoutPipe()
if err != nil {
return nil, err
Expand Down Expand Up @@ -199,7 +202,7 @@ func (c *client) PS() (map[string]PSEntry, error) {
}

func (c *client) Expose() error {
output, err := exec.Command("weave", "--local", "ps", "weave:expose").Output()
output, err := weaveCommand("--local", "ps", "weave:expose").Output()
if err != nil {
return err
}
Expand All @@ -208,8 +211,14 @@ func (c *client) Expose() error {
// Alread exposed!
return nil
}
if err := exec.Command("weave", "--local", "expose").Run(); err != nil {
if err := weaveCommand("--local", "expose").Run(); err != nil {
return fmt.Errorf("Error running weave expose: %v", err)
}
return nil
}

func weaveCommand(arg ...string) exec.Cmd {
cmd := exec.Command("weave", arg...)
cmd.SetEnv(append(os.Environ(), "DOCKER_API_VERSION="+dockerAPIVersion))
return cmd
}
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LABEL works.weave.role=system
WORKDIR /home/weave
RUN apk add --update bash runit conntrack-tools iproute2 util-linux curl && \
rm -rf /var/cache/apk/*
ADD ./docker.tgz /
ADD ./docker /usr/local/bin/
ADD ./demo.json /
ADD ./weave ./weaveutil /usr/bin/
COPY ./scope ./runsvinit ./entrypoint.sh /home/weave/
Expand Down
2 changes: 1 addition & 1 deletion scope
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ check_docker_access() {
fi
}

# - The image embeds the weave script & Docker 1.10.3 client
# - The image embeds the weave script & Docker 1.13.1 client (mimicking a 1.10 client)
# - Weave needs 1.10.0 now (image pulling changes)
MIN_DOCKER_VERSION=1.10.0

Expand Down
202 changes: 202 additions & 0 deletions vendor/cloud.google.com/go/compute/metadata/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0ebc0b9

Please sign in to comment.