大网数据广告活动
服务器运维问答

Jenkins on Docker - Free Swap Space 0

· 52CE 我爱测

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?

问题原文

原帖链接 · dknaack · CC BY-SA 3.0

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?

社区高分解答

原帖链接 · AAber · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-08-24)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。