Docker-OSX
Docker-OSX copied to clipboard
How to allocate more CPU cores and Memory to a docker image/container ?
Hi, I know this is not really an issue, but it's a user"me" issue, I'm running EndeavourOS latest,
I installed Monteray following the initial setup and then the docker run it
command from the read me page, and it works really good, but I would like to allocate more resources to the image/container
I've tried following some of the examples but I just can't get it to work.
Let's say the i.e.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 123456789 sickcodes/docker-osx:monterey "/bin/bash -c 'sudo …" 2 days ago Exited (0) 23 hours ago gifted_pirate
I currently start the docker image with docker start -ai 12345679
how would I add the variables to give it 8cpu cores and 16gb ram?
Eventually, when I can afford a 2nd GPU I would like to learn how to do GPU passthrough to that image as well.
It would be much appreciated if you could explain this to me in layman's terms, as I'm just starting to learn docker and VM's when you teach me how to do it I will make a YT video on my channel showing how to do it, because I'm sure I'm not the only one struggling with this stuff, in the beginning, I will give you full credit!
if any of these matters here are my system specs: MSI unify x570 MB Ryzen 3950X Radeon VII 32GB ram m.2 pcie gen 4 storage
Hi, you can check this solution.
Say you need 8cpu cores
, you can add following parameters to your docker run command
-e EXTRA="-smp 8,sockets=1,cores=8,threads=1
// or if you prefer more threads
-e EXTRA="-smp 8,sockets=1,cores=4,threads=2
// or if you prefer more sockets
-e EXTRA="-smp 8,sockets=2,cores=2,threads=2
Since you have Ryzen 3950X, maybe you can use more cpu resources such as
-e EXTRA="-smp 16,sockets=1,cores=8,threads=2
And if you need 16gb ram
, you can add this
-e RAM=16
I've tried all the ways I can think of to implement that in my startup, but it does not seem to work.
Xhost -
start -ai 12345679 -e EXTRA="-smp 8,sockets=1,cores=8,threads=1" -e RMA=16
Xhost +
Any input on how to implement that the right way?
I think you should declare how much resources you need when you create
the container not when start
.
Here is my configuration
docker run -i \
--name myMacOSX2 \
--privileged \
--device /dev/kvm \
-e RAM=32 \
-p 50922:10022 \
-p 3001:3001 \
-e "DISPLAY=${DISPLAY:-:0.0}" \
-e EXTRA="-smp 8,sockets=1,cores=8,threads=1 -device virtio-serial-pci -device usb-host,hostbus=1,hostport=2.3 -monitor telnet::45454,server,nowait -nographic -serial null -spice disable-ticketing,port=3001" \
-e GENERATE_UNIQUE=true \
-e GENERATE_SPECIFIC=true \
-e NOPICKER=true \
-v "${PWD}/output.env:/env" \
-v "${PWD}/mac_hdd_ng.img:/image" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
sickcodes/docker-osx:naked
Is there a way to update the RAM and CPU AFTER creation? I already installed Ventura and it takes a while. I'd like to avoid doing that all over again.
Not sure if it is possible
-
docker export
your image asxxx.tar
-
docker load
yourxxx.tar
-
docker run
with updated resources allocation