dockur / macos

OSX (macOS) inside a Docker container.
MIT License
674 stars 53 forks source link

Network bridge to my physical network #56

Open kiryasolod opened 3 months ago

kiryasolod commented 3 months ago

Operating system

Ubuntu 24.04

Description

I have 20.20.20.0/24 network inside MacOS but I need 192.168.1.0/24 How to do it? I tried to add some configs to compose file but it changed only the IP address for VNC, so now I connect to 192.168.1.230:8006 instead of localhost:8006. The address of MacOS itself remains the same

Docker compose

services:
  osx:
    image: dockurr/macos
    container_name: macos
    networks:
      macvlan_network:
        ipv4_address: 192.168.1.230
    environment:
      VERSION: "sonoma"
      DISK_SIZE: "30G"
      RAM_SIZE: "6G"
      CPU_CORES: "4"
      ARGUMENTS: "-device usb-host,vendorid=0x1234,productid=0x1234"
    devices:
      - /dev/kvm
      - /dev/bus/usb
    cap_add:
      - NET_ADMIN
    ports:
      - 8006:8006
      - 5900:5900/tcp
      - 5900:5900/udp
    stop_grace_period: 2m
    volumes:
      - /home/garrus/osx:/storage
networks:
  macvlan_network:
    driver: macvlan
    driver_opts:
      parent: wlp0s20f3
    ipam:
      config:
        - subnet: 192.168.1.0/24
        - gateway: 192.168.1.1

Docker log

[+] Running 1/0
 ✔️ Container macos  Created                                                                                                                                                               0.0s
Attaching to macos
macos  | ❯ Starting macOS for Docker v1.07...
macos  | ❯ For support visit https://github.com/dockur/macos
macos  | ❯ CPU: 12th Gen Intel Core TM i5 12500H | RAM: 11/16 GB | DISK: 48 GB (ext4) | HOST: 6.8.0-11...
macos  |
macos  | ❯ Booting macOS 1920x1080 using QEMU v8.2.4...
macos  |
BdsDxe: failed to load Boot0080 "Mac OS X" from PciRoot(0x0)/Pci(0xA,0x0)/VenMedia(BE74FCF7-0B7C-49F3-9147-01F4042E6842,C721072703DFDF44A2EDE14FCF3272E0)/\8BB805C3-BC2A-475C-A66E-EF417F138315\System\Library\CoreServices\boot.efi: Not Found
macos  | BdsDxe: failed to load Boot0001 "UEFI Misc Device" from PciRoot(0x0)/Pci(0xA,0x0): Not Found
macos  | BdsDxe: loading Boot0002 "UEFI Misc Device 2" from PciRoot(0x0)/Pci(0x5,0x0)
macos  | BdsDxe: starting Boot0002 "UEFI Misc Device 2" from PciRoot(0x0)/Pci(0x5,0x0)
macos  | #[EB|LOG:EXITBS:END] _
macos  | #[EB.BST.FBS|-]
macos  | #[EB|B:BOOT]
macos  | #[EB|LOG:HANDOFF TO XNU] _
macos  | ======== End of efiboot serial output. ========

Screenshots (optional)

image_2024-06-28_13-25-49 If I set the parameters manually, I lose my connection, I cannot ping google.com, for example

kroese commented 2 days ago

You can use these steps:

https://github.com/dockur/windows#how-can-windows-acquire-an-ip-address-from-my-router

They are for the Windows container, but also apply to this macOS container.