Run the following command to see if your host has a swap file configured:
free|grep-iSwapSwap: 000
If you get "Swap: 0 0 0" like you see above your host has no swap configured.
Configure a swap file on your host
ddif=/dev/zeroof=swapfilebs=1Mcount=1Kmkswapswapfilesudochownroot:rootswapfilesudochmod600swapfilesudoswaponswapfile
Verify your swap is configured:
free|grep-iSwapSwap: 104857201048572
Good, we have a swap on the host.
Run your Jenkins docker by typing
dockerrun--privileged-p8080:8080--namejenkins-p50000:50000jenkins
Notice you must run the docker in privileged mode.
When you run your Jenkins docker in privileged mode the host's swap will be available inside the docker, so your Jenkins master will have a working swap.
If your host already has a working swap in place, all you will need to do is run the Jenkins docker in privileged mode.