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

Can I add more RAM later in my macOS instance? If so, how do I do it?

Open jaovito opened this issue 3 years ago • 10 comments

I upgraded my RAM PC and I want OSX on the docker to use more RAM, too, but I don't want to have to reinstall it again. I use linux (ubuntu).

jaovito avatar May 26 '21 01:05 jaovito

It's in the doc and previous issues.

  1. extract the image with docker cp
  2. pass it into a new container created with image docker.io/sickcodes/docker-osx:naked & -v path/to/the/copied/image:/image
  3. use -e RAM=16 to set the desired cap

coppercash avatar May 26 '21 01:05 coppercash

Thanks man, I will try this

jaovito avatar May 26 '21 23:05 jaovito

Did it work??

mchemweno avatar Jun 11 '21 08:06 mchemweno

No need to do all that stuff. Here is a much simpler solution that I saw nowhere posted.

The following is useful if you want to change the resolution, RAM, nopicker, headless, and all other options of an existing container, without copying images / creating new containers:

1. Stop docker

sudo systemctl stop docker

2. Install a simple lib that formats JSON files (for easier editing)

sudo apt-get -y install jq

3. Take the configuration of you current container, format it, and put it back

sudo jq . /var/lib/docker/containers/<CONTAINER-FULL-ID>/config.v2.json > ~/config.v2.json
sudo mv ~/config.v2.json /var/lib/docker/containers/<CONTAINER-FULL-ID>/config.v2.json

4. Change anything you want (usually under Env:)

nano /var/lib/docker/containers/<CONTAINER-FULL-ID>/config.v2.json

5. Restart docker

sudo systemctl restart docker

To find the <CONTAINER-FULL-ID> run sudo ls /var/lib/docker/containers/ or docker inspect <container-short-id>

Notes (the following apply on step 4 above)

  • Change resolution Set Env -> "WIDTH=<your-number>" Set Env -> "HEIGHT=<your-number>"

  • Make headless Set Env -> "EXTRA=-display none" (You need to set-up an access method like SSH before)

  • Change RAM Set Env -> "RAM=<your-number>"

  • Disable boot screen (disk selector) to boot directly in your installation Set Env -> "MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-nopicker-custom.plist"

christosnc avatar Jun 11 '21 13:06 christosnc

Very awesome solution!! Thanks!

mchemweno avatar Jun 15 '21 12:06 mchemweno

Thanks @coppercash & @christosnc!

I think the jq solution is perfecto and I would like to add it to the Documentation, did you want to PR that comment @christosnc?

sickcodes avatar Jun 15 '21 13:06 sickcodes

Thanks, sure! I'll make a PR.

christosnc avatar Jun 19 '21 19:06 christosnc

This issue can be closed, but I could make a PR to expand on it:

  1. If you want to add a port mapping, I think you also need to edit the file hostconfig.json (I haven't tested yet)
  2. I'm assuming some ENV vars are only read when the vm is created and cannot be modified later. It could be nice to list which ones are eligible for modification.

gronka avatar Dec 07 '21 11:12 gronka

@christosnc @sickcodes it is a good solution. i think it is a very good thing to add all possible post configurations into a seperate section in the readme, i.e i am trying to mount a shared volume which again asks me to install from scratch but i am sure it would be possible from this config therefore if we can have a section in the readme with all post installation customizations, it would be great!

Samadmehmood avatar Mar 06 '24 05:03 Samadmehmood

Why don't I have this file /config.v2.json

kotoSky avatar Apr 10 '24 10:04 kotoSky