Skip to content

Fix BusyBox grep incompatibility in containerized host IP detection#175

Merged
lpcox merged 2 commits into
mainfrom
copilot/fix-grep-unrecognized-option
Jan 12, 2026
Merged

Fix BusyBox grep incompatibility in containerized host IP detection#175
lpcox merged 2 commits into
mainfrom
copilot/fix-grep-unrecognized-option

Conversation

Copilot AI commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

The containerized gateway script fails when detecting host IP on Alpine Linux because it uses grep -oP (Perl regex), which BusyBox grep doesn't support.

Changes

run_containerized.sh:246 - Replace Perl regex with BusyBox-compatible pipeline:

# Before: Perl regex with lookbehind assertion (unsupported in BusyBox)
HOST_IP=$(ip -4 addr show 2>/dev/null | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v '^127\.' | head -1)

# After: Standard POSIX commands
HOST_IP=$(ip -4 addr show 2>/dev/null | grep 'inet ' | awk '{print $2}' | cut -d/ -f1 | grep -v '^127\.' | head -1)

The new pipeline extracts the same IPv4 addresses using only commands available in BusyBox (grep, awk, cut).


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix grep unrecognized option error in container setup Fix BusyBox grep incompatibility in containerized host IP detection Jan 12, 2026
Copilot AI requested a review from lpcox January 12, 2026 00:34
@lpcox lpcox marked this pull request as ready for review January 12, 2026 00:35
@lpcox lpcox merged commit 8e3c5d6 into main Jan 12, 2026
@lpcox lpcox deleted the copilot/fix-grep-unrecognized-option branch January 12, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants