Docker-OSX
Docker-OSX copied to clipboard
Can I add more RAM later in my macOS instance? If so, how do I do it?
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).
It's in the doc and previous issues.
- extract the image with
docker cp
- pass it into a new container created with image
docker.io/sickcodes/docker-osx:naked
&-v path/to/the/copied/image:/image
- use
-e RAM=16
to set the desired cap
Thanks man, I will try this
Did it work??
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"
Very awesome solution!! Thanks!
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?
Thanks, sure! I'll make a PR.
This issue can be closed, but I could make a PR to expand on it:
- If you want to add a port mapping, I think you also need to edit the file hostconfig.json (I haven't tested yet)
- 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.
@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!
Why don't I have this file /config.v2.json