sh 添加交换标签:docker

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 添加交换标签:docker相关的知识,希望对你有一定的参考价值。

# Docker Error: Returned a Non-zero Code: 137 - samwize
# http://samwize.com/2016/05/19/docker-error-returned-a-non-zero-code-137/

# Confirm you have no swap
sudo swapon -s

# Allocate 1GB (or more if you wish) in /swapfile
sudo fallocate -l 1G /swapfile

# Make it secure
sudo chmod 600 /swapfile
ls -lh /swapfile

# Activate it
sudo mkswap /swapfile
sudo swapon /swapfile

# Confirm again there's indeed more memory now
free -m
sudo swapon -s

# Configure fstab to use swap when instance restart
sudo nano /etc/fstab

# Add this line to /etc/fstab, save and exit
/swapfile   none    swap    sw    0   0

# Change swappiness to 10, so that swap is used only when 10% RAM is unused
# The default is too high at 60
echo 10 | sudo tee /proc/sys/vm/swappiness
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf

以上是关于sh 添加交换标签:docker的主要内容,如果未能解决你的问题,请参考以下文章

sh 检查docker image标签是否存在

sh docker图片标签拉

sh 添加交换到Ubuntu 16.04

sh Docker将用户添加到docker Group

sh 在linux操作系统上添加交换文件

sh 添加Docker apt repo