IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # Focker
  2. ## Introduction
  3. Focker is a FreeBSD image orchestration tool in the vein of Docker.
  4. ## Installation
  5. In order to use Focker you need a ZFS pool available in your FreeBSD installation.
  6. ### Installing the Python package
  7. Run:
  8. ```bash
  9. git clone https://github.com/sadaszewski/focker.git
  10. cd focker/
  11. python setup.py install
  12. ```
  13. or (if you want an uninstaller):
  14. ```bash
  15. git clone https://github.com/sadaszewski/focker.git
  16. cd focker/
  17. python setup.py sdist
  18. pip install dist/focker-0.9.tgz
  19. ```
  20. ### Setting up ZFS
  21. Upon first execution of the `focker` command, Focker will automatically create the necessary directories and ZFS datasets. You just need to exclude the unlikely case that you are already using /focker in your filesystem hierarchy. The layout after initialization will look the following:
  22. ```
  23. /focker
  24. /focker/images
  25. /focker/jails
  26. /focker/volumes
  27. ```
  28. `images`, `jails`, and `volumes` have corresponding ZFS datasets with `canmount=off` so that they serve as mountpoint anchors for child entries.
  29. ### Preparing base image
  30. To bootstrap the images system you need to install FreeBSD in jail mode to a ZFS dataset placed in /focker/images and provide two user-defined properties - `focker:sha256` and `focker:tags`. One way to achieve this would be the following:
  31. ```bash
  32. TAGS="freebsd-latest freebsd-$(freebsd-version | cut -d'-' -f1)"
  33. VERSION="FreeBSD $(freebsd-version)"
  34. SHA256=$(echo -n ${VERSION} | sha256)
  35. NAME=${SHA256:0:7}
  36. zfs create -o focker:sha256=${SHA256} -o focker:tags="${TAGS}" zroot/focker/images/${NAME}
  37. bsdinstall jail /focker/images/${NAME}
  38. zfs set readonly=on zroot/focker/images/${NAME}
  39. zfs snapshot zroot/focker/images/${NAME}@1
  40. ```
  41. ## Usage
  42. At this point, Focker is ready to use.
  43. ### `focker` command syntax
  44. ```
  45. focker
  46. |- image|img|im|i
  47. | |- build|b
  48. | | |- FOCKER_DIR
  49. | | `- --tags|-t TAG [...TAG]
  50. | |- tag|t
  51. | | |- REFERENCE
  52. | | `- TAG [...TAG]
  53. | |- untag|u
  54. | | `- TAG [...TAG]
  55. | |- list|ls|l
  56. | | `- --full-sha256|-f
  57. | |- prune|p
  58. | `- remove|r
  59. | | |- REFERENCE
  60. | | `- --remove-dependents|-R
  61. |- jail|j
  62. | |- create|c
  63. | | |- image
  64. | | |- --command|-c COMMAND (default: /bin/sh)
  65. | | |- --env|-e VAR1:VALUE1 [...VARN:VALUEN]
  66. | | |- --mounts|-m FROM1:ON1 [...FROMN:ONN]
  67. | | `- --hostname|-n HOSTNAME
  68. | |- start|s
  69. | | `- REFERENCE
  70. | |- stop|S
  71. | | `- REFERENCE
  72. | |- remove|r
  73. | | `- REFERENCE
  74. | |- exec|e
  75. | | |- REFERENCE
  76. | | `- [...COMMAND]
  77. | |- oneshot|o
  78. | | `- IMAGE
  79. | | `- --env|-e VAR1:VALUE1 [...VARN:VALUEN]
  80. | | `- --mounts|-m FROM1:ON1 [...FROMN:ONN]
  81. | | `- [...COMMAND]
  82. | |- list|ls|l
  83. | | `- --full-sha256|-f
  84. | |- tag|t
  85. | | |- REFERENCE
  86. | | `- TAG [...TAG]
  87. | |- untag|u
  88. | | `- TAG [...TAG]
  89. | `- prune|p
  90. | | `- --force|-f
  91. |- volume
  92. | |- create
  93. | |- prune
  94. | |- list
  95. | |- tag
  96. | `- untag
  97. `- compose
  98. |- build
  99. `- run
  100. ```