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.
- 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/swapfile count=2000000 bs=1024
- Change the permissions and run
chmod go= /var/swapfile && mkswap /var/swapfile
- Set the swapfile to be used:
echo "/var/swapfile swap swap defaults 0 0" >> /etc/fstab
- Activate the swap:
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