From ffd43fa27af525f5ea782ee77ea3d70bd86b4ece Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 12 Feb 2026 15:58:11 +0100 Subject: [PATCH] use /usr/src/moby instead, and no GOPATH Signed-off-by: Sebastiaan van Stijn --- .devcontainer/devcontainer.json | 4 +-- .github/workflows/.windows.yml | 28 ++++++++++----------- .github/workflows/buildkit.yml | 8 +++--- Dockerfile | 8 +++--- Dockerfile.simple | 4 +-- Dockerfile.windows | 14 +++++------ Makefile | 4 +-- docs/contributing/software-req-win.md | 6 ++--- hack/dind-systemd | 2 +- hack/dockerfiles/generate-files.Dockerfile | 2 +- hack/dockerfiles/govulncheck.Dockerfile | 2 +- internal/testutil/fixtures/plugin/plugin.go | 7 +++--- 12 files changed, 44 insertions(+), 45 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fab3f6eb34..f9626b2407 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,8 +5,8 @@ "dockerfile": "../Dockerfile", "target": "devcontainer" }, - "workspaceFolder": "/go/src/github.com/moby/moby/v2", - "workspaceMount": "source=${localWorkspaceFolder},target=/go/src/github.com/moby/moby/v2,type=bind,consistency=cached", + "workspaceFolder": "/usr/src/moby", + "workspaceMount": "source=${localWorkspaceFolder},target=${containerWorkspaceFolder},type=bind,consistency=cached", "remoteUser": "root", "runArgs": ["--privileged"], diff --git a/.github/workflows/.windows.yml b/.github/workflows/.windows.yml index bf0646db3c..2f0ba1c372 100644 --- a/.github/workflows/.windows.yml +++ b/.github/workflows/.windows.yml @@ -46,13 +46,13 @@ jobs: BIN_OUT: ${{ github.workspace }}\out defaults: run: - working-directory: ${{ env.GOPATH }}/src/github.com/moby/moby/v2 + working-directory: /usr/src/moby steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: - path: ${{ env.GOPATH }}/src/github.com/moby/moby/v2 + path: /usr/src/moby - name: Env run: | @@ -112,9 +112,9 @@ jobs: name: Copy artifacts run: | New-Item -ItemType "directory" -Path "${{ env.BIN_OUT }}" - docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\src\github.com\moby\moby\v2\bundles\docker.exe" ${{ env.BIN_OUT }}\ - docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\src\github.com\moby\moby\v2\bundles\dockerd.exe" ${{ env.BIN_OUT }}\ - docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\src\github.com\moby\moby\v2\bundles\docker-buildx.exe" ${{ env.BIN_OUT }}\ + docker cp "${{ env.TEST_CTN_NAME }}`:c`:\usr\src\moby\bundles\docker.exe" ${{ env.BIN_OUT }}\ + docker cp "${{ env.TEST_CTN_NAME }}`:c`:\usr\src\moby\bundles\dockerd.exe" ${{ env.BIN_OUT }}\ + docker cp "${{ env.TEST_CTN_NAME }}`:c`:\usr\src\moby\bundles\docker-buildx.exe" ${{ env.BIN_OUT }}\ docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\bin\gotestsum.exe" ${{ env.BIN_OUT }}\ docker cp "${{ env.TEST_CTN_NAME }}`:c`:\containerd\bin\containerd.exe" ${{ env.BIN_OUT }}\ docker cp "${{ env.TEST_CTN_NAME }}`:c`:\containerd\bin\containerd-shim-runhcs-v1.exe" ${{ env.BIN_OUT }}\ @@ -136,13 +136,13 @@ jobs: GOBIN: ${{ github.workspace }}\go\bin defaults: run: - working-directory: ${{ env.GOPATH }}/src/github.com/moby/moby/v2 + working-directory: /usr/src/moby steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: - path: ${{ env.GOPATH }}/src/github.com/moby/moby/v2 + path: /usr/src/moby - name: Env run: | @@ -198,14 +198,14 @@ jobs: name: Test run: | & docker run --name ${{ env.TEST_CTN_NAME }} -e "DOCKER_GITCOMMIT=${{ github.sha }}" ` - -v "${{ env.GOPATH }}\src\github.com\moby\moby\v2\bundles:C:\gopath\src\github.com\moby\moby\v2\bundles" ` + -v "C:\usr\src\moby\bundles:C:\usr\src\moby\bundles" ` ${{ env.TEST_IMAGE_NAME }} hack\make.ps1 -TestUnit - name: Send to Codecov if: inputs.send_coverage uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2 with: - working-directory: ${{ env.GOPATH }}\src\github.com\moby\moby\v2 + working-directory: C:\usr\src\moby\ directory: bundles env_vars: RUNNER_OS flags: unit @@ -216,7 +216,7 @@ jobs: uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: ${{ inputs.os }}-${{ inputs.storage }}-unit-reports - path: ${{ env.GOPATH }}\src\github.com\moby\moby\v2\bundles\* + path: C:\usr\src\moby\bundles\* retention-days: 1 unit-test-report: @@ -306,13 +306,13 @@ jobs: BIN_OUT: ${{ github.workspace }}\out defaults: run: - working-directory: ${{ env.GOPATH }}/src/github.com/moby/moby/v2 + working-directory: /usr/src/moby steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: - path: ${{ env.GOPATH }}/src/github.com/moby/moby/v2 + path: /usr/src/moby - name: Set up Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 @@ -511,7 +511,7 @@ jobs: if: inputs.send_coverage uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2 with: - working-directory: ${{ env.GOPATH }}\src\github.com\moby\moby\v2 + working-directory: C:\usr\src\moby\ directory: bundles env_vars: RUNNER_OS flags: integration,${{ matrix.runtime }} @@ -555,7 +555,7 @@ jobs: uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: ${{ inputs.os }}-${{ inputs.storage }}-integration-reports-${{ matrix.runtime }}-${{ env.TESTREPORTS_NAME }} - path: ${{ env.GOPATH }}\src\github.com\moby\moby\v2\bundles\* + path: C:\usr\src\moby\bundles\* retention-days: 1 integration-test-report: diff --git a/.github/workflows/buildkit.yml b/.github/workflows/buildkit.yml index 9585f52bcc..23efd45187 100644 --- a/.github/workflows/buildkit.yml +++ b/.github/workflows/buildkit.yml @@ -180,12 +180,12 @@ jobs: TEST_CTN_NAME: moby defaults: run: - working-directory: ${{ env.GOPATH }}/src/github.com/moby/moby/v2 + working-directory: /usr/src/moby steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: - path: ${{ env.GOPATH }}/src/github.com/moby/moby/v2 + path: /usr/src/moby - name: Env run: | @@ -252,8 +252,8 @@ jobs: - name: Copy artifacts run: | New-Item -ItemType "directory" -Path "${{ env.BIN_OUT }}" - docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\src\github.com\moby\moby\v2\bundles\docker.exe" ${{ env.BIN_OUT }}\ - docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\src\github.com\moby\moby\v2\bundles\dockerd.exe" ${{ env.BIN_OUT }}\ + docker cp "${{ env.TEST_CTN_NAME }}`:c`:\usr\src\moby\bundles\docker.exe" ${{ env.BIN_OUT }}\ + docker cp "${{ env.TEST_CTN_NAME }}`:c`:\usr\src\moby\bundles\dockerd.exe" ${{ env.BIN_OUT }}\ docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\bin\gotestsum.exe" ${{ env.BIN_OUT }}\ docker cp "${{ env.TEST_CTN_NAME }}`:c`:\containerd\bin\containerd.exe" ${{ env.BIN_OUT }}\ docker cp "${{ env.TEST_CTN_NAME }}`:c`:\containerd\bin\containerd-shim-runhcs-v1.exe" ${{ env.BIN_OUT }}\ diff --git a/Dockerfile b/Dockerfile index ae3f3c034d..9096de2ecf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -440,7 +440,7 @@ ENV PATH=/usr/local/cli:$PATH ENV TEST_CLIENT_BINARY=/usr/local/cli-integration/docker ENV CONTAINERD_ADDRESS=/run/docker/containerd/containerd.sock ENV CONTAINERD_NAMESPACE=moby -WORKDIR /go/src/github.com/moby/moby/v2 +WORKDIR /usr/src/moby VOLUME /var/lib/docker VOLUME /home/unprivilegeduser/.local/share/docker # Wrap all commands in the "docker-in-docker" script to allow nested containers @@ -470,13 +470,13 @@ RUN useradd --create-home --gid docker unprivilegeduser \ && mkdir -p /home/unprivilegeduser/.local/share/docker \ && chown -R unprivilegeduser /home/unprivilegeduser # Let us use a .bashrc file -RUN ln -sfv /go/src/github.com/moby/moby/v2/.bashrc ~/.bashrc +RUN ln -sfv /usr/src/moby/.bashrc ~/.bashrc # Activate bash completion RUN echo "source /usr/share/bash-completion/bash_completion" >> /etc/bash.bashrc RUN ldconfig # Set dev environment as safe git directory to prevent "dubious ownership" errors # when bind-mounting the source into the dev-container. See https://github.com/moby/moby/pull/44930 -RUN git config --global --add safe.directory $GOPATH/src/github.com/moby/moby/v2 +RUN git config --global --add safe.directory /usr/src/moby # This should only install packages that are specifically needed for the dev environment and nothing else # Do you really need to add another package here? Can it be done in a different build stage? RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \ @@ -526,7 +526,7 @@ COPY --link --from=dockercli-integration /build/ /usr/local/cli-integration FROM base AS build COPY --from=gowinres /build/ /usr/local/bin/ -WORKDIR /go/src/github.com/moby/moby/v2 +WORKDIR /usr/src/moby ENV CGO_ENABLED=1 RUN --mount=type=cache,sharing=locked,id=moby-build-aptlib,target=/var/lib/apt \ --mount=type=cache,sharing=locked,id=moby-build-aptcache,target=/var/cache/apt \ diff --git a/Dockerfile.simple b/Dockerfile.simple index 4a4d0e7995..0c38ee0218 100644 --- a/Dockerfile.simple +++ b/Dockerfile.simple @@ -57,5 +57,5 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ ENV PATH=/usr/local/cli:$PATH ENV AUTO_GOPATH 1 -WORKDIR /usr/src/docker -COPY . /usr/src/docker +WORKDIR /usr/src/moby +COPY . /usr/src/moby diff --git a/Dockerfile.windows b/Dockerfile.windows index bc33f3dace..58a5a7feca 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -45,8 +45,8 @@ # # 1. Clone the sources from github.com: # -# >> git clone https://github.com/moby/moby.git C:\gopath\src\github.com\moby\moby\v2 -# >> Cloning into 'C:\gopath\src\github.com\moby\moby\v2'... +# >> git clone https://github.com/moby/moby.git C:\usr\src\moby +# >> Cloning into 'C:\usr\src\moby'... # >> remote: Counting objects: 186216, done. # >> remote: Compressing objects: 100% (21/21), done. # >> remote: Total 186216 (delta 5), reused 0 (delta 0), pack-reused 186195 @@ -59,7 +59,7 @@ # # 2. Change directory to the cloned docker sources: # -# >> cd C:\gopath\src\github.com\moby\moby\v2 +# >> cd C:\usr\src\moby # # # 3. Build a docker image with the components required to build the docker binaries from source @@ -79,8 +79,8 @@ # 5. Copy the binaries out of the container, replacing HostPath with an appropriate destination # folder on the host system where you want the binaries to be located. # -# >> docker cp binaries:C:\gopath\src\github.com\moby\moby\v2\bundles\docker.exe C:\HostPath\docker.exe -# >> docker cp binaries:C:\gopath\src\github.com\moby\moby\v2\bundles\dockerd.exe C:\HostPath\dockerd.exe +# >> docker cp binaries:C:\usr\src\moby\bundles\docker.exe C:\HostPath\docker.exe +# >> docker cp binaries:C:\usr\src\moby\bundles\dockerd.exe C:\HostPath\dockerd.exe # # # 6. (Optional) Remove the interim container holding the built executable binaries: @@ -267,7 +267,7 @@ RUN ` Remove-Item C:\containerd.tar.gz; ` ` # Ensure all directories exist that we will require below.... - $srcDir = """$Env:GOPATH`\src\github.com\moby\moby\v2\bundles"""; ` + $srcDir = """C:\usr\src\moby\bundles"""; ` Write-Host INFO: Ensuring existence of directory $srcDir...; ` New-Item -Force -ItemType Directory -Path $srcDir | Out-Null; ` ` @@ -306,7 +306,7 @@ RUN ` ENTRYPOINT ["powershell.exe"] # Set the working directory to the location of the sources -WORKDIR ${GOPATH}\src\github.com\moby\moby\v2 +WORKDIR /usr/src/moby # Copy the sources into the container COPY . . diff --git a/Makefile b/Makefile index 57f91f5fd3..c747bb221f 100644 --- a/Makefile +++ b/Makefile @@ -86,13 +86,13 @@ BIND_DIR := $(if $(BINDDIR),$(BINDDIR),$(if $(DOCKER_HOST),,.)) # DOCKER_MOUNT can be overridden, but use at your own risk! ifndef DOCKER_MOUNT -DOCKER_MOUNT := $(if $(BIND_DIR),-v "$(BIND_DIR):/go/src/github.com/moby/moby/v2/$(BIND_DIR)") +DOCKER_MOUNT := $(if $(BIND_DIR),-v "$(BIND_DIR):/usr/src/moby/$(BIND_DIR)") DOCKER_MOUNT := $(if $(DOCKER_BINDDIR_MOUNT_OPTS),$(DOCKER_MOUNT):$(DOCKER_BINDDIR_MOUNT_OPTS),$(DOCKER_MOUNT)) # This allows the test suite to be able to run without worrying about the underlying fs used by the container running the daemon (e.g. aufs-on-aufs), so long as the host running the container is running a supported fs. # The volume will be cleaned up when the container is removed due to `--rm`. # Note that `BIND_DIR` will already be set to `bundles` if `DOCKER_HOST` is not set (see above BIND_DIR line), in such case this will do nothing since `DOCKER_MOUNT` will already be set. -DOCKER_MOUNT := $(if $(DOCKER_MOUNT),$(DOCKER_MOUNT),-v /go/src/github.com/moby/moby/v2/bundles) -v "$(CURDIR)/.git:/go/src/github.com/moby/moby/v2/.git" +DOCKER_MOUNT := $(if $(DOCKER_MOUNT),$(DOCKER_MOUNT),-v /usr/src/moby/bundles) -v "$(CURDIR)/.git:/usr/src/moby/.git" DOCKER_MOUNT_CACHE := -v docker-dev-cache:/root/.cache -v docker-mod-cache:/go/pkg/mod/ DOCKER_MOUNT_CLI := $(if $(DOCKER_CLI_PATH),-v $(shell dirname $(DOCKER_CLI_PATH)):/usr/local/cli,) diff --git a/docs/contributing/software-req-win.md b/docs/contributing/software-req-win.md index cc3885bef9..8caf665358 100644 --- a/docs/contributing/software-req-win.md +++ b/docs/contributing/software-req-win.md @@ -100,8 +100,8 @@ To build Moby, run: Copy out the resulting Windows Moby Engine binary to `dockerd.exe` in the current directory: - docker cp binaries:C:\gopath\src\github.com\moby\moby\v2\bundles\docker.exe docker.exe - docker cp binaries:C:\gopath\src\github.com\moby\moby\v2\bundles\dockerd.exe dockerd.exe + docker cp binaries:C:\usr\src\moby\bundles\docker.exe docker.exe + docker cp binaries:C:\usr\src\moby\bundles\dockerd.exe dockerd.exe To test it, stop the system Docker daemon and start the one you just built: @@ -110,7 +110,7 @@ To test it, stop the system Docker daemon and start the one you just built: The other make targets work too, to run unit tests try: - docker run --rm docker-builder sh -c 'cd /c/gopath/src/github.com/moby/moby/v2; hack/make.sh test-unit' + docker run --rm docker-builder sh -c 'cd /c/usr/src/moby; hack/make.sh test-unit' ### 6. Remove the interim binaries container diff --git a/hack/dind-systemd b/hack/dind-systemd index dcae8614c2..5d7e45eb2d 100755 --- a/hack/dind-systemd +++ b/hack/dind-systemd @@ -95,7 +95,7 @@ After=firewalld.service Type=oneshot ExecStart=/bin/true RemainAfterExit=true -ExecStop=cp /var/log/firewalld /go/src/github.com/moby/moby/v2/bundles/firewalld.log +ExecStop=cp /var/log/firewalld /usr/src/moby/bundles/firewalld.log [Install] WantedBy=firewalld.service diff --git a/hack/dockerfiles/generate-files.Dockerfile b/hack/dockerfiles/generate-files.Dockerfile index 7e09dd6b57..1fe2d36558 100644 --- a/hack/dockerfiles/generate-files.Dockerfile +++ b/hack/dockerfiles/generate-files.Dockerfile @@ -17,7 +17,7 @@ RUN <