Docker-OSX icon indicating copy to clipboard operation
Docker-OSX copied to clipboard

Question about persistent setup and docker commit

Open sebbekarlsson opened this issue 2 years ago • 3 comments

Some background: I'm using this to work on an IOS app in XCode.

I really need my setup to be persistent so that I don't need to re-install OSX everytime. Do I understand things correctly, I need to run "docker commit" everytime before I shut down the OSX machine in order to save the state?

Cheers, Sebastian

sebbekarlsson avatar Mar 09 '22 11:03 sebbekarlsson

What you need to do is extract the HDD image and use it when you create a new container, so you always keep the same data.

You can find the image like this:

sudo find /var/lib/docker -size +10G | grep mac_hdd_ng.img

Move it somewhere you want to have it accessible. Then start a new container with the parameter.

-v "the-location-you-pick/mac_hdd_ng.img:/image" \

Julioevm avatar Mar 11 '22 08:03 Julioevm

perhaps there are some use cases where avoiding docker and using osx-kvm directly makes more sense..

maltegrosse avatar Mar 11 '22 12:03 maltegrosse

Yes for a simple persisten setup, osx-kvm can be enough. But I think Docker-OSX is easier to setup these days. Up to him to decide :slightly_smiling_face:

Julioevm avatar Mar 11 '22 14:03 Julioevm

For those trying to do this with the High Sierra image, this is what I had to do:

#!/bin/bash
docker run \
    --privileged -i \
    --device /dev/kvm \
    -p 50922:10022 \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -v /LOCAL_PERSISTENT_PATH/mac_hdd_ng.img:/home/arch/OSX-KVM/mac_hdd_ng.img \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    -e AUDIO_DRIVER=pa,server=unix:/tmp/pulseaudio.socket \
    -v "/run/user/$(id -u)/pulse/native:/tmp/pulseaudio.socket" \
    sickcodes/docker-osx:high-sierra

satmandu avatar Apr 25 '23 22:04 satmandu