services: socat: image: alpine/socat # Connects to a service running on port 1337 on the host machine and creates a unix socket listener command: UNIX-LISTEN:/sockets/shared.sock,unlink-early,unlink-close,fork TCP-CONNECT:host.docker.internal:1337,reuseaddr # unlink-* deletes the socket file before start up and when the connection is closed restart: unless-stopped volumes: - sockets:/sockets # It needs access to the host, hence the default network networks: - default isolated: image: alpine volumes: - sockets:/sockets # Isolate the host's networking network_mode: "none" # Create a standard docker volume, this will reside on the host VM rather than the underlying macOS or Windows volumes: sockets: