From e7c2073b6dcbbc58e63de6ca3702534b606dded2 Mon Sep 17 00:00:00 2001 From: William Stearns Date: Mon, 21 Feb 2022 12:02:39 -0500 Subject: [PATCH 1/4] NOT SURE IF NEEDED: force platform --- zeek | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zeek b/zeek index e6bfc7c..2e62c92 100755 --- a/zeek +++ b/zeek @@ -133,6 +133,7 @@ main() { $SUDO docker volume create zeek-zkg-state >/dev/null docker_cmd=("docker" "run" "--detach") # start container in the background + docker_cmd+=("--platform" "$(uname -m)") # force the right architecture docker_cmd+=("--name" "$container") # provide a predictable name docker_cmd+=("--restart" "$restart") docker_cmd+=("--cap-add" "net_raw") # allow Zeek to listen to raw packets @@ -234,7 +235,8 @@ main() { pull|update) #Command needed to pull down a new version of Zeek if there's a new docker image - $SUDO docker pull "$IMAGE_NAME" + #The "--platform linux/$(uname -m)" makes sure we pull down the right CPU type (x86_64 for intel or aarch64 for arm) + $SUDO docker pull --platform linux/$(uname -m) "$IMAGE_NAME" $0 stop $0 start From 60e94d55186b0a2a2368689e677227b0da02c97c Mon Sep 17 00:00:00 2001 From: William Stearns Date: Thu, 24 Feb 2022 15:23:20 -0500 Subject: [PATCH 2/4] Use docker_arch variable instead of uname -m. --- zeek | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/zeek b/zeek index 2e62c92..1fd0e9c 100755 --- a/zeek +++ b/zeek @@ -24,6 +24,18 @@ if [ ! -w "/var/run/docker.sock" ]; then SUDO="sudo --preserve-env " fi +case "`uname -m`" in +x86_64) + docker_arch='linux/amd64' + ;; +aarch64) + docker_arch='linux/arm64' + ;; +*) + echo "Unknown architecture `uname -m` , exiting." >&2 + exit 1 +esac + #The user can set the top level directory that holds all zeek content by setting it in "zeek_top_dir" (default "/opt/zeek") HOST_ZEEK=${zeek_top_dir:-/opt/zeek} #Note, we force the 3.0 release for stability, though the user can override it by setting the "zeek_release" environment variable @@ -133,7 +145,7 @@ main() { $SUDO docker volume create zeek-zkg-state >/dev/null docker_cmd=("docker" "run" "--detach") # start container in the background - docker_cmd+=("--platform" "$(uname -m)") # force the right architecture + docker_cmd+=("--platform" "$docker_arch") # force the right architecture docker_cmd+=("--name" "$container") # provide a predictable name docker_cmd+=("--restart" "$restart") docker_cmd+=("--cap-add" "net_raw") # allow Zeek to listen to raw packets @@ -235,8 +247,8 @@ main() { pull|update) #Command needed to pull down a new version of Zeek if there's a new docker image - #The "--platform linux/$(uname -m)" makes sure we pull down the right CPU type (x86_64 for intel or aarch64 for arm) - $SUDO docker pull --platform linux/$(uname -m) "$IMAGE_NAME" + #The "--platform linux/$docker_arch" makes sure we pull down the right CPU type (linux/amd64 for x86_64 aka intel or linux/arm64 for aarch64 aka arm) + $SUDO docker pull --platform "$docker_arch" "$IMAGE_NAME" $0 stop $0 start From f4e042a3d45564b8370fe08dffebc3004020b1f7 Mon Sep 17 00:00:00 2001 From: William Stearns Date: Thu, 24 Feb 2022 15:28:30 -0500 Subject: [PATCH 3/4] docker_arch: support armv7 --- zeek | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zeek b/zeek index 1fd0e9c..4cd59d0 100755 --- a/zeek +++ b/zeek @@ -31,6 +31,9 @@ x86_64) aarch64) docker_arch='linux/arm64' ;; +armv7l) + docker_arch='linux/arm/v7' + ;; *) echo "Unknown architecture `uname -m` , exiting." >&2 exit 1 From 4556542c7db0c7487734dc49dc3c980992a8b698 Mon Sep 17 00:00:00 2001 From: William Stearns Date: Thu, 24 Feb 2022 15:33:24 -0500 Subject: [PATCH 4/4] docker_arch: script typo --- zeek | 1 + 1 file changed, 1 insertion(+) diff --git a/zeek b/zeek index 4cd59d0..511b82b 100755 --- a/zeek +++ b/zeek @@ -37,6 +37,7 @@ armv7l) *) echo "Unknown architecture `uname -m` , exiting." >&2 exit 1 + ;; esac #The user can set the top level directory that holds all zeek content by setting it in "zeek_top_dir" (default "/opt/zeek")