diff options
| author | David Thompson <davet@gnu.org> | 2015-06-19 08:57:44 -0400 |
|---|---|---|
| committer | David Thompson <dthompson2@worcester.edu> | 2015-10-25 20:27:19 -0400 |
| commit | f535dcbe198e7f88f3b0cd8aa4d7585191b31080 (patch) | |
| tree | ecc716aed8764e046fd3ff4b0ccf297686d3df0e /doc | |
| parent | 581176c00b424ea6ddbeec38ba5dfaea43b53bcc (diff) | |
scripts: environment: Add --container option.
* guix/scripts/system.scm (specification->file-system-mapping): Move from
here...
* guix/ui.scm (specification->file-system-mapping): ... to here.
* guix/scripts/enviroment.scm (show-help): Show help for new options.
(%options): Add --container --network, --expose, and --share options.
(%network-configuration-files): New variable.
(launch-environment, launch-environment/container, requisites*,
inputs->requisites): New procedures.
(guix-environment): Spawn new process in a container when requested.
* doc/guix.texi (Invoking guix environment): Document it.
* tests/guix-environment-container.sh: New file.
* Makefile.am (SH_TESTS): Add it.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/guix.texi | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 99c10d8dc74..7715b72818e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -4681,6 +4681,18 @@ NumPy: | |||
| 4681 | guix environment --ad-hoc python2-numpy python-2.7 -- python | 4681 | guix environment --ad-hoc python2-numpy python-2.7 -- python |
| 4682 | @end example | 4682 | @end example |
| 4683 | 4683 | ||
| 4684 | Sometimes it is desirable to isolate the environment as much as | ||
| 4685 | possible, for maximal purity and reproducibility. In particular, when | ||
| 4686 | using Guix on a host distro that is not GuixSD, it is desirable to | ||
| 4687 | prevent access to @file{/usr/bin} and other system-wide resources from | ||
| 4688 | the development environment. For example, the following command spawns | ||
| 4689 | a Guile REPL in a ``container'' where only the store and the current | ||
| 4690 | working directory are mounted: | ||
| 4691 | |||
| 4692 | @example | ||
| 4693 | guix environment --ad-hoc --container guile -- guile | ||
| 4694 | @end example | ||
| 4695 | |||
| 4684 | The available options are summarized below. | 4696 | The available options are summarized below. |
| 4685 | 4697 | ||
| 4686 | @table @code | 4698 | @table @code |
| @@ -4741,6 +4753,49 @@ environment. | |||
| 4741 | @item --system=@var{system} | 4753 | @item --system=@var{system} |
| 4742 | @itemx -s @var{system} | 4754 | @itemx -s @var{system} |
| 4743 | Attempt to build for @var{system}---e.g., @code{i686-linux}. | 4755 | Attempt to build for @var{system}---e.g., @code{i686-linux}. |
| 4756 | |||
| 4757 | @item --container | ||
| 4758 | @itemx -C | ||
| 4759 | @cindex container | ||
| 4760 | Run @var{command} within an isolated container. The current working | ||
| 4761 | directory outside the container is mapped to @file{/env} inside the | ||
| 4762 | container. Additionally, the spawned process runs as the current user | ||
| 4763 | outside the container, but has root privileges in the context of the | ||
| 4764 | container. | ||
| 4765 | |||
| 4766 | @item --network | ||
| 4767 | @itemx -N | ||
| 4768 | For containers, share the network namespace with the host system. | ||
| 4769 | Containers created without this flag only have access to the loopback | ||
| 4770 | device. | ||
| 4771 | |||
| 4772 | @item --expose=@var{source}[=@var{target}] | ||
| 4773 | For containers, expose the file system @var{source} from the host system | ||
| 4774 | as the read-only file system @var{target} within the container. If | ||
| 4775 | @var{target} is not specified, @var{source} is used as the target mount | ||
| 4776 | point in the container. | ||
| 4777 | |||
| 4778 | The example below spawns a Guile REPL in a container in which the user's | ||
| 4779 | home directory is accessible read-only via the @file{/exchange} | ||
| 4780 | directory: | ||
| 4781 | |||
| 4782 | @example | ||
| 4783 | guix environment --container --expose=$HOME=/exchange guile -- guile | ||
| 4784 | @end example | ||
| 4785 | |||
| 4786 | @item --share | ||
| 4787 | For containers, share the file system @var{source} from the host system | ||
| 4788 | as the writable file system @var{target} within the container. If | ||
| 4789 | @var{target} is not specified, @var{source} is used as the target mount | ||
| 4790 | point in the container. | ||
| 4791 | |||
| 4792 | The example below spawns a Guile REPL in a container in which the user's | ||
| 4793 | home directory is accessible for both reading and writing via the | ||
| 4794 | @file{/exchange} directory: | ||
| 4795 | |||
| 4796 | @example | ||
| 4797 | guix environment --container --share=$HOME=/exchange guile -- guile | ||
| 4798 | @end example | ||
| 4744 | @end table | 4799 | @end table |
| 4745 | 4800 | ||
| 4746 | It also supports all of the common build options that @command{guix | 4801 | It also supports all of the common build options that @command{guix |
| @@ -7064,6 +7119,7 @@ This command also installs GRUB on the device specified in | |||
| 7064 | @item vm | 7119 | @item vm |
| 7065 | @cindex virtual machine | 7120 | @cindex virtual machine |
| 7066 | @cindex VM | 7121 | @cindex VM |
| 7122 | @anchor{guix system vm} | ||
| 7067 | Build a virtual machine that contain the operating system declared in | 7123 | Build a virtual machine that contain the operating system declared in |
| 7068 | @var{file}, and return a script to run that virtual machine (VM). | 7124 | @var{file}, and return a script to run that virtual machine (VM). |
| 7069 | Arguments given to the script are passed as is to QEMU. | 7125 | Arguments given to the script are passed as is to QEMU. |
