Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow running Docker container on MacOS (without in-container USB support) #24412

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/getting_started_docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ By default docker or podman are automatically detected and docker is preferred o
RUNTIME="podman" util/docker_build.sh keyboard:keymap:target
```

If flashing is not required, it's possible to run the container as unprivileged (on Linux), and without docker-machine (on Windows/macOS):

```
SKIP_FLASHING_SUPPORT=1 util/docker_build.sh keyboard:keymap:target
```


## FAQ

### Why can't I flash on Windows/macOS
Expand Down
20 changes: 11 additions & 9 deletions util/docker_cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ if [ -z "$RUNTIME" ]; then
fi
fi


# IF we are using docker on non Linux and docker-machine isn't working print an error
# ELSE set usb_args
if [ ! "$(uname)" = "Linux" ] && [ "$RUNTIME" = "docker" ] && ! docker-machine active >/dev/null 2>&1; then
errcho "Error: target requires docker-machine to work on your platform"
errcho "See http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos"
exit 3
else
usb_args="--privileged -v /dev:/dev"
# If SKIP_FLASHING_SUPPORT is defined, do not check for docker-machine and do not run a privileged container
if [ -z "$SKIP_FLASHING_SUPPORT" ]; then
# IF we are using docker on non Linux and docker-machine isn't working print an error
# ELSE set usb_args
if [ ! "$(uname)" = "Linux" ] && [ "$RUNTIME" = "docker" ] && ! docker-machine active >/dev/null 2>&1; then
errcho "Error: target requires docker-machine to work on your platform"
errcho "See http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos"
exit 3
else
usb_args="--privileged -v /dev:/dev"
fi
fi

qmk_firmware_dir=$(pwd -W 2>/dev/null) || qmk_firmware_dir=$PWD # Use Windows path if on Windows
Expand Down