Swap memory

Hi, I’ve just confirmed a deploy based on alpine using this as the final line in my Dockerfile:

CMD if [[ ! -z "$SWAP" ]]; then fallocate -l $(($(stat -f -c "(%a*%s/10)*7" .))) _swapfile && mkswap _swapfile && swapon _swapfile && ls -hla; fi; free -m; /app/run

You then need to set SWAP="true" in your fly.toml to enable the swap partition. That flag is needed to allow the container to run correctly under your local docker server.

10 Likes