-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(back): #1370 add swap to container #1371
Conversation
jpverde
commented
Aug 13, 2024
- Added swap configuration for the makes container
- Added swap configuration for the makes container Signed-off-by: John Perez <[email protected]>
Quality Gate passedIssues Measures |
@@ -30,13 +30,28 @@ __nixpkgs__.dockerTools.buildImage { | |||
__nixpkgs__.gnutar | |||
__nixpkgs__.gzip | |||
__nixpkgs__.nixVersions.nix_2_15 | |||
__nixpkgs__.util-linux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is unnecessary. You can directly run commands via runCommand
in order to configure swap.
'') | ||
# Creat swapfile for the system | ||
(__nixpkgs__.runCommand "swap-file" { } '' | ||
dd if=/dev/zero of=/mnt/swapfile bs=1M count=2048 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this work if the container is provided a volume smaller than 2GB?
'') | ||
# Enable swap | ||
(__nixpkgs__.runCommand "swap-enable" { } '' | ||
swapon /mnt/swapfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swapon /mnt/swapfile | |
${__nixpkgs__.util-linux}/bin/swapon /mnt/swapfile |
Using swap on containers seems to go further than configuring the container itself 🤔 https://kubernetes.io/blog/2023/08/24/swap-linux-beta/ https://docs.docker.com/engine/containers/resource_constraints/#--memory-swap-details |