Skip to content

Instantly share code, notes, and snippets.

@c5m
Created November 28, 2022 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c5m/1d41575c1fe3c3bc7cf948cf4ffdf31c to your computer and use it in GitHub Desktop.
Save c5m/1d41575c1fe3c3bc7cf948cf4ffdf31c to your computer and use it in GitHub Desktop.
An example of how to set up a connection from MacOS to inside the Podman Host VM
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# run script with TRACE=1 ... to enable debugging
if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi
PODMAN_PORT=$(podman system connection list --format=json | jq '.[0].URI' | sed -E 's|.+://.+@.+:([[:digit:]]+)/.+|\1|')
PODMAN_INTERNAL_UID=$(podman system info --format=json | jq '.host.idMappings.uidmap[0].host_id')
rm -f /tmp/podman.sock
ssh -v -i ~/.ssh/podman-machine-default \
-p "$PODMAN_PORT" \
-L "/tmp/podman.sock:/run/user/$PODMAN_INTERNAL_UID/podman/podman.sock" \
-N core@localhost
@c5m
Copy link
Author

c5m commented Nov 28, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment