mirror of
https://github.com/docker/cli.git
synced 2026-08-24 02:24:17 -05:00
docker.Makefile: Use active context socket
The development and e2e containers hard-code /var/run/docker.sock, so rootless and other local contexts cannot expose their daemon socket. Resolve the active context's Docker endpoint and strip the unix scheme before using it as the bind source. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
+4
-3
@@ -8,6 +8,7 @@
|
||||
DOCKER_CLI_MOUNTS ?= -v "$(CURDIR)":/go/src/github.com/docker/cli
|
||||
DOCKER_CLI_CONTAINER_NAME ?=
|
||||
DOCKER_CLI_GO_BUILD_CACHE ?= y
|
||||
DOCKER_SOCK ?= $(or $(patsubst unix://%,%,$(filter unix://%,$(shell docker context inspect --format '{{.Endpoints.docker.Host}}'))),/var/run/docker.sock)
|
||||
|
||||
# Sets the name of the company that produced the windows binary.
|
||||
PACKAGER_NAME ?=
|
||||
@@ -62,7 +63,7 @@ dynbinary: ## build dynamically linked binary
|
||||
.PHONY: dev
|
||||
dev: build_docker_image ## start a build container in interactive mode for in-container development
|
||||
$(DOCKER_RUN) -it \
|
||||
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
|
||||
--mount 'type=bind,src=$(DOCKER_SOCK),dst=/var/run/docker.sock' \
|
||||
$(DEV_DOCKER_IMAGE_NAME)
|
||||
|
||||
shell: dev ## alias for dev
|
||||
@@ -134,14 +135,14 @@ test-e2e: test-e2e-local test-e2e-connhelper-ssh ## run all e2e tests
|
||||
test-e2e-local: build-e2e-image # run experimental e2e tests
|
||||
docker run --rm $(ENVVARS) \
|
||||
--mount type=bind,src=$(CURDIR)/build/coverage,dst=/tmp/coverage \
|
||||
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
|
||||
--mount 'type=bind,src=$(DOCKER_SOCK),dst=/var/run/docker.sock' \
|
||||
$(E2E_IMAGE_NAME)
|
||||
|
||||
.PHONY: test-e2e-connhelper-ssh
|
||||
test-e2e-connhelper-ssh: build-e2e-image # run experimental SSH-connection helper e2e tests
|
||||
docker run --rm $(ENVVARS) -e TEST_CONNHELPER=ssh \
|
||||
--mount type=bind,src=$(CURDIR)/build/coverage,dst=/tmp/coverage \
|
||||
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
|
||||
--mount 'type=bind,src=$(DOCKER_SOCK),dst=/var/run/docker.sock' \
|
||||
$(E2E_IMAGE_NAME)
|
||||
|
||||
.PHONY: help
|
||||
|
||||
Reference in New Issue
Block a user