cookbook/container: example of building+running docker containers.
This got... long... and complicated. But I think it's a really good demonstration of getting redo to do complicated things elegantly. At least, I hope it is.
This commit is contained in:
parent
01497f55e9
commit
3923a7d3f8
38 changed files with 1375 additions and 7 deletions
8
docs/cookbook/container/memcalc.py
Executable file
8
docs/cookbook/container/memcalc.py
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
import os, sys
|
||||
st = os.stat(sys.argv[1])
|
||||
megabytes = st.st_size // 1024 // 1024
|
||||
# initrd size is limited to 50% of available RAM. To be safe, we'll
|
||||
# request at least 3x initrd size, and no less than 64M.
|
||||
need = megabytes * 3 + 64
|
||||
print("%dM" % need)
|
||||
Loading…
Add table
Add a link
Reference in a new issue