Make docker container memory a CLI argument

This commit is contained in:
Mikhail f. Shiryaev 2024-12-05 13:14:33 +01:00
parent 9489137e23
commit 5b1d454f2e
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4

View File

@ -286,6 +286,14 @@ if __name__ == "__main__":
help="Set network driver for runnner container (defaults to `host`)",
)
parser.add_argument(
"--memory",
# Default is host memory - 2GiB
default=physical_memory() - 2 * 1024**3,
help="Set the memory limit for the docker container, "
"accepts the same argument as `docker run --memory`",
)
parser.add_argument(
"--docker-image-version",
default="latest",
@ -479,7 +487,7 @@ if __name__ == "__main__":
cmd_base = (
f"docker run {net} {tty} --rm --name {CONTAINER_NAME} "
"--privileged --dns-search='.' " # since recent dns search leaks from host
f"--memory={physical_memory() - 2 * 1024**3} "
f"--memory={args.memory} "
f"--volume={args.odbc_bridge_binary}:/clickhouse-odbc-bridge "
f"--volume={args.binary}:/clickhouse "
f"--volume={args.library_bridge_binary}:/clickhouse-library-bridge "