wonderful-boots-93625
03/30/2023, 8:47 PMdocker_image
target invocation? Context is I need to pass networking mode and a host override to use an existing ssh tunnel. I see run_args
and build_args
but I don’t think those work for thiscurved-television-6568
03/30/2023, 9:12 PMdocker build
out of the box. If you’re adventurous you could create a docker
shim script and make pants pick that up forwarding your build request with any additional args as required.wonderful-boots-93625
03/30/2023, 9:15 PMwonderful-boots-93625
03/30/2023, 9:18 PMexecutable_search_paths
to find it?wonderful-boots-93625
03/30/2023, 9:25 PMcurved-television-6568
03/30/2023, 9:26 PM+x
executable script named docker
on path ought to tick all the boxes we care about…wonderful-boots-93625
03/30/2023, 9:27 PMcurved-television-6568
03/30/2023, 9:27 PMwonderful-boots-93625
03/30/2023, 9:28 PM$ ls -l /Users/nasron/gitroot/edge/pants-docker-shim/
total 16
-rwxr-xr-x 1 nasron staff 128 30 Mar 17:20 docker
-rw-r--r-- 1 nasron staff 159 30 Mar 17:20 docker~
nasron aws:root py:3.9.10 (set by /Users/nasron/.pyenv/version) tf:tf:disabled ~/gitroot/edge on feature/EDGE-1519-fixing-pants-fl-server-client-docker
$ tail pants.toml
lockfile='pytest.lock'
[test]
use_coverage = true
[docker]
build_verbose = true
executable_search_paths = [
'/Users/nasron/gitroot/edge/pants-docker-shim/',
]%
gives
BinaryNotFoundError: Cannot find `docker` on `['/Users/nasron/gitroot/edge/pants-docker-shim/']`. Please ensure that it is installed so that Pants can interact with the docker daemon.
curved-television-6568
03/31/2023, 2:55 PMpants.engine.process.ProcessExecutionFailure: Process 'Building docker image test-example:1.2.5' failed with exit code 1.
stdout:
DOCKER shim: build --pull=False --tag test-example:1.2.5 --file testprojects/src/python/docker/Dockerfile.example .
stderr:
error: open .docker/buildx/instances/colima: no such file or directory
with:
#!/bin/bash
echo "DOCKER shim: $@"
exec /opt/homebrew/bin/docker "$@"
fails on subsequent step as I don’t have the rest properly setup…wonderful-boots-93625
03/31/2023, 3:44 PMwonderful-boots-93625
05/16/2023, 12:38 AMnutritious-hair-72580
05/17/2023, 12:30 PM--no-pantsd
might help?nutritious-hair-72580
05/17/2023, 2:23 PM#!/bin/bash
echo "Using Docker shim with args: $@"
if [ "$1" == "build" ]; then
echo "Running build with '--network=host'"
shift
# Needed for GHA on EKS to set network mode.
exec /usr/bin/docker build --network=host "$@"
exit 0
fi
exec /usr/bin/docker "$@"
wonderful-boots-93625
01/08/2024, 4:06 PMnutritious-hair-72580
01/08/2024, 10:34 PMwonderful-boots-93625
02/12/2024, 4:17 PMnutritious-hair-72580
02/12/2024, 9:58 PMwonderful-boots-93625
02/13/2024, 9:57 PMwonderful-boots-93625
02/13/2024, 9:58 PMwonderful-boots-93625
02/13/2024, 9:58 PMdocker -v
. If the binary doesn’t exit cleanly it appears as “no executable found” error. So I had to fake it in the shim for depot
.wonderful-boots-93625
07/16/2024, 3:15 PM