sickcodes / Docker-OSX

Run macOS VM in a Docker! Run near native OSX-KVM in Docker! X11 Forwarding! CI/CD for OS X Security Research! Docker mac Containers.
https://hub.docker.com/r/sickcodes/docker-osx
GNU General Public License v3.0
45.36k stars 2.4k forks source link

Use Docker volumes (or binds) #66

Closed jlxip closed 3 years ago

jlxip commented 4 years ago

For better persistence, along with using docker start, either Docker volumes or binds should be mentioned in the README to back up the virtual hard drive, transfer it to another computer, or, even more important, allowing uncomplicated qemu configuration changes. This shouldn't be too far from adding a new -v parameter to the launch command, and will make a difference.

sickcodes commented 4 years ago

In the original version, I had OSX-KVM folder move to another location, and then mount voulme, move across. mv in a Dockerfile is actually a copy to new layer, so build time was slow.

I abandoned the idea because the user would have to: Copy a large .img file from the Docker container to their disk. OR They would have to build the OSX-KVM themselves first.

If you have a third idea, feel free to suggest or submit a PR.

Here is the original abandoned code if you want to submit a PR:

The below code is not complete.


# Persistent:
#       
#      To keep a permanent disk, use a bind mount.
#      Change /home/user/somefolder to where you want to keep the files.
#      
#      docker run --privileged -p 8888:5901 --mount type=bind,src=/home/user/somefolder,dst=/home/arch/OSX-KVM -it osx-kvm
#      docker run --privileged -p 8888:5901 -v /root/folder:/home/arch/OSX-KVM -it osx-kvm /bin/bash

# stash the folder to /home/arch/stash so when we mount volume, it will bring it to our host
RUN mkdir /home/arch/stash
RUN mkdir /home/arch/stash/OSX-KVM
RUN mv /home/arch/OSX-KVM /home/arch/stash
RUN sudo chown -R arch:arch /home/arch
# this is abandoned test code
CMD cp -r --no-clobber /home/arch/stash/OSX-KVM/* /home/arch/OSX-KVM && ./OpenCore-Boot_custom.sh"
sickcodes commented 3 years ago

I will add the ability to specify an overriding images folder similar to what I did in https://github.com/sickcodes/Docker-eyeOS

sickcodes commented 3 years ago

Added https://github.com/sickcodes/Docker-OSX#quick-start-own-image