12

I've noticed that my master node on Jenkins shows

free swap space: 0 B

So I added a swap file as described here.

But this has no effect. What am I doing wrong?

wogsland
  • 199
  • 1
  • 4
  • 12
dknaack
  • 249
  • 1
  • 3
  • 10
  • Hi @dknaack, any luck oh finding the reason for this? – olyv Nov 20 '17 at 08:39
  • 1
    @olyv my container was running in a kubernetes cluster. After giving the deployment more resources, the problem was solved. Good luck and have a great day! – dknaack Nov 20 '17 at 09:10
  • 1
    Thanks for your response. I will continue investigate issue wtih my jenkins – olyv Nov 20 '17 at 09:48

1 Answers1

6

Run the following command to see if your host has a swap file configured:

free|grep -i Swap
Swap:            0          0          0

If you get "Swap: 0 0 0" like you see above your host has no swap configured.

Configure a swap file on your host:

sudo dd if=/dev/zero of=swapfile bs=1M count=1K
sudo mkswap swapfile
sudo chown root:root swapfile
sudo chmod 600 swapfile
sudo swapon swapfile

Verify your swap is configured:

free|grep -i Swap
Swap:      1048572          0    1048572

Good, we have a swap on the host.

Run your Jenkins docker by typing:

docker run --privileged -p 8080:8080 --name jenkins -p 50000:50000 jenkins

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.

DavidXYZ
  • 103
  • 2
AAber
  • 161
  • 1
  • 4