Long time, no post. That's what we call holidays. Anyways, here's ho to increase the size of swap available in Docker. When you try to set up an OracleDB inside a docker container, you'll probably need this.
Note: This works only with the native virtualization version of Docker for Mac. If you still use
boot2docker, you need to follow the guide in this issue.
Note: This guide was updated in February 2018 because Docker has changed the underlying vm. (more info)
- Open any terminal, make sure that
screenis installed (use Homebrew)
- Connect to the Docker VM:
- You might need to press enter or login to show the prompt. The username is root and the password is empty.
- Create a new swapfile:
dd if=/dev/zero of=/var/lib/swapfile count=2000000 bs=1024
- Change the permissions and run
chmod go= /var/lib/swapfile && mkswap /var/lib/swapfile
- Activate the swap:
swapon -v /var/lib/swapfile
ctrl+a dto detach the screen session
Note that you'll lose the swap, when the machine is recreated or you restart Docker.
In this case you'll just need to repeat steps two and six to eight, because the swapfile is still present. (This doesn't apply, if you completely recreated the Docker machine)
Subscribe to Lerk's Blog
Get the latest posts delivered right to your inbox