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

Closed
opened 2025-12-29 00:20:01 +01:00 by adam · 10 comments
Owner

Originally created by @jaovito on GitHub (May 26, 2021).

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).

Originally created by @jaovito on GitHub (May 26, 2021). 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).
adam added the documentationhelp wanted labels 2025-12-29 00:20:01 +01:00
adam closed this issue 2025-12-29 00:20:01 +01:00
Author
Owner

@coppercash commented on GitHub (May 26, 2021):

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 commented on GitHub (May 26, 2021): 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
Author
Owner

@jaovito commented on GitHub (May 27, 2021):

Thanks man, I will try this

@jaovito commented on GitHub (May 27, 2021): Thanks man, I will try this
Author
Owner

@mchemweno commented on GitHub (Jun 11, 2021):

Did it work??

@mchemweno commented on GitHub (Jun 11, 2021): Did it work??
Author
Owner

@christosnc commented on GitHub (Jun 11, 2021):

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)

@christosnc commented on GitHub (Jun 11, 2021): 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** ```bash sudo systemctl stop docker ``` **2. Install a simple lib that formats JSON files (for easier editing)** ```bash sudo apt-get -y install jq ``` **3. Take the configuration of you current container, format it, and put it back** ```bash 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:)** ```bash nano /var/lib/docker/containers/<CONTAINER-FULL-ID>/config.v2.json ``` **5. Restart docker** ```bash 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"
Author
Owner

@mchemweno commented on GitHub (Jun 15, 2021):

Very awesome solution!! Thanks!

@mchemweno commented on GitHub (Jun 15, 2021): Very awesome solution!! Thanks!
Author
Owner

@sickcodes commented on GitHub (Jun 15, 2021):

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 commented on GitHub (Jun 15, 2021): 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?
Author
Owner

@christosnc commented on GitHub (Jun 19, 2021):

Thanks, sure! I'll make a PR.

@christosnc commented on GitHub (Jun 19, 2021): Thanks, sure! I'll make a PR.
Author
Owner

@gronka commented on GitHub (Dec 7, 2021):

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 commented on GitHub (Dec 7, 2021): 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.
Author
Owner

@Samadmehmood commented on GitHub (Mar 6, 2024):

@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 commented on GitHub (Mar 6, 2024): @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!
Author
Owner

@kotoSky commented on GitHub (Apr 10, 2024):

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

@kotoSky commented on GitHub (Apr 10, 2024): Why don't I have this file /config.v2.json
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#193