.\" Automatically generated by Pandoc 2.5 .\" .TH "DUE" "1" "" "Version 2.3.0" "Dedicated User Environment" .hy .SH NAME .PP \f[B]due\f[R] \- Dedicated User Environment. A build environment for your build environments. .SH SYNOPSIS .PP \f[B]due\f[R] [\f[B]\-r|\[en]run\f[R] \f[I]args\f[R]] [\f[I]dedication\f[R]] .PD 0 .P .PD \f[B]due\f[R] [ \f[B]\[en]create\f[R] \f[I]args\f[R] ] [\f[I]dedication\f[R]] .PD 0 .P .PD \f[B]due\f[R] [ \f[B]\[en]delete\f[R] \f[I]term\f[R] ] [\f[I]dedication\f[R]] .PD 0 .P .PD \f[B]due\f[R] [\f[B]\-m\f[R]|\f[B]\[en]manage\f[R] \f[I]args\f[R]] [\f[I]dedication\f[R]] .PD 0 .P .PD \f[B]due\f[R] [\f[B]\-v\f[R]|\f[B]\[en]version\f[R]] .PD 0 .P .PD \f[B]due\f[R] [\f[B]\-h\f[R]|\f[B]\[en]help\f[R]] .SH DESCRIPTION .PP DUE is a set of wrapper scripts for both creating Docker container based build environments, and running them with intelligent defaults so that the user can feel like they are still on the host system. .PP Key features include: .PP 1 \- Creating an account in the container for the user at run time and mounting the user\[cq]s home/work directory so configuration files are available. .PP 2 \- List based browsing of images to run and active containers to log in to. .PP 3 \- Use of container `templates' to pre configure and build containers for a particular target or Debian based operating system, eliminating errors caused by missing dependencies, or misconfiguration. .PP 4 \- Commands can be run using the container without having to log into it, allowing for use in automated build environments. .SS Functional Options .PP Each of these options has context specific help and sub commands .TP .B \-r, \[en]run Start new containers. .TP .B \[en]build, \[en]duebuild Execute container\[cq]s /usr/local/bin/duebuild script in current directory. See the \[en]run section for more. .TP .B \[en]create Make and configure new Docker images. .TP .B \[en]delete Delete existing Docker images that match the term. .TP .B \-m, \[en]manage Manipulate and query existing images. .TP .B \-h, \[en]help Usage information. .TP .B \-v, \[en]version Print DUE\[cq]s version number. .SS \[en]run options .PP These options are available after the \[en]run argument, and relate to starting and logging in to containers. .SS Starting an image .TP .B \-i, \[en]run\-image [filter] Allows the user to reduce the number of images shown to run by restricting them to entries that contain [filter]. If only one image matches the filter, it will be invoked without asking the user to choose it. .TP .B \-a, \[en]all Show all containers on the system. DUE can be used to log in to containers that it did not create, but the user may have to supply a default \[en]username and \[en]userid (usually \[en]username root and \[en]userid 0. See below ) .TP .B \[en]ignore\-type .IP .nf \f[C] When accessing the container, do not attempt to create a user \f[R] .fi .RS account for the user logging in, and assume the container was not created by DUE. This can be useful with image creation debug. .RE .TP .B \-c, \[en]command [cmd] Run [cmd] in the container using the \[en]login\-shell. This must be the last command parsed, as [cmd] is handed off to be run in the container. The primary use of this would be using the container to build without having to interactively log in to it. Note: when issuing multiple commands, remember to \[dq]\[dq] your arguments, and backslash () any semicolons (;) used to split up the commands. Otherwise the shell where the commands are invoked will take anything after the first ;, and treat it as a command to be run locally. This can obfuscate things if the command can work inside or out of the container. .PD 0 .P .PD Example: look at /proc and the password file in a container: ./due \[en]run \[en]command \[lq]ls \-lrt /proc\[rq] ; \[lq]cat /etc/passwd\[rq] .TP .B \[en]build | \[en]duebuild If there is a /usr/local/bin/duebuild script in the container, this option will run it with a default configuration, or take additional passed arguments if present. Those arguments will vary depending on the nature of the target being built by the container\[cq]s duebuild script. For more information, check the template/README.md for the image type, or use: due \[en]duebuild \[en]help to select a container and get its duebuild script\[cq]s help options directly. .TP .B \[en]duebuild Same behavior as \[en]build, but a bit clearer that it is working with the selected container\[cq]s duebuild script. One notable difference is that due \[en]duebuild \[en]help will select a container and execute duebuild \[en]help to see the options provided by that particular script. .TP .B \[en]dockerarg [arg] Put [arg] in the docker run invocation. For multiple arguments, use multiple invocations of \[en]dockerarg. This allows for things like running containers with \[en]privileged .TP .B \[en]debug Sets defaults of \[en]username root \[en]userid 0 and the \[en]any option to show images that were not created by DUE. Helpful for internal debug if image creation dies running internal configuration scripts. .TP .B \[en]container\-name name Change the name of the running container. This can provide clarity in a build automation environment, where containers may be automatically spun up. Note that if the new name does not have `due' in it, it will be filtered out from DUE\[cq]s \[en]login option unless \[en]all is also provided. This may or may not be desirable behavior. .TP .B \[en]home\-dir [host path] Absolute path to a directory to use as the home directory when the user logs in. Defaults to the user\[cq]s home directory unless overridden with this argument, or set otherwise in /etc/due/due.conf, or \[ti]/config/due/due.conf .TP .B \[en]mount\-dir [hp:cp] Mount absolute path on host system (hp) at absolute path in container. The colon (:) is necessary to separate the two. Multiple \[en]mount\-dir commands can be used in a single invocation. Example: mount host /tmp dir in container /var/build: \[en]mount\-dir /tmp/:var/build .SS Logging in to a running container .TP .B \-l, \[en]login Choose an existing container to log in to. .TP .B \[en]username [username] Name to use when logging in. .TP .B \[en]userid [id#] User ID to use when logging in. .TP .B \[en]groupname [groupname] Container user\[cq]s default group .TP .B \[en]groupid [id#] ID of container user\[cq]s group .TP .B \[en]login\-shell [path] Program to use as login .TP .B \[en]help\-runtime Invoke runtime help .TP .B \[en]help\-runtime\-examples Show examples of use .SS \[en]create options .PP These options are accessed after the \[en]create argument, and, predictably enough, relate to creating new images. .SS Creation Overview .PP Containers created by DUE will always have files from \&./templates/common\-templates in every image. The primary example of this is the \f[B]container\-create\-user.sh\f[R] script that sets up an account for the user in the container, and allows commands to be run in the container as if it was the user invoking them. .PP The order of creation is as follows, using the debian\-package template as an example, where the resulting image will be named `debian\-package\-10' .PP 1 \- The contents of common\-templates are copied to a debian\-package\-10\-template\-merge directory under \&./due\-build\-merge/ .PD 0 .P .PD 2 \- The contents of the debian\-package template directory copied in to the debian\-package\-10\-template\-merge directory and will overwrite any files with identical names. .PD 0 .P .PD 3 \- Any REPLACE_ fields in the template files are replaced with values supplied from the command line (such as the starting container image) and all files are copied to ./due\-build\-merge/debian\-package\-10 .PD 0 .P .PD 4 \- The ./due\-build\-merge/debian\-package\-10/Dockerfile.create file is used to create the image from this build directory. .SS Creation tips .PP Quick image changes can be made by editing the build directory ( \&./due\-build\-merge/debian\-package\-10 ) and re running ./due \[en]create \[en]build\-dir ./due\-build\-merge/debian\-package\-10 .PP The final image will hold a /due\-configuration directory, which holds everything that went into the image. This is very useful for install script debug inside the container. .SS Creation example .PP 1 \- Configure an image build directory under due\-build\-merge named from \[en]name Mandatory: .TP .B \[en]from [name:tag] Pull name:tag from registry to use as starting point for the image. .TP .B \[en]use\-template [role] Use files from templates/[role] to generate the config directory. .TP .B \[en]description \[lq]desc\[rq] Quoted string to describe the container on login. .TP .B \[en]name name Name for resulting image and config directory. Ex: debian\-stretch\-build, ubuntu\-18.04\-build, etc .PP Optional: .TP .B \[en]prompt [prompt] Set in container prompt to [prompt] to provide user context .TP .B \[en]no\-image With \[en]create, allow directories to be created, but do not try to build the image. Effectively stops use of \[en]dir. Useful for debugging directory configuration issues. .TP .B \[en]filter [term] With \[en]create \[en]help, filter examples to contain [term]. .PP 2 \- Build a Docker image from the image build directory. .TP .B \[en]dir [dirname] Build using an existing configuration directory. .TP .B \[en]clean Delete the due\-build\-merge staging directories. .SS \[en]manage options .PP These options are accessed after the \[en]manage argument, and can make working with containers/images easier. .TP .B \-l, \[en]list\-images List images created by DUE. .TP .B \[en]stop Use the menu interface to stop a running container. Works with \[en]all to show containers not started by the user. If is supplied, it will match all the user\[cq]s containers to that pattern and produce a script that can be edited and run to delete the listed containers. NOTE: \[en]all \[en]stop can be used to do some serious damage. NOTE: since all DUE containers are started with \-rm, stopping a container deletes it and all the data in it from memory. .TP .B \[en]export\-container name Export a running container to disk as a Docker image named name. Note that to run the saved image it must be added back to the system with \[en]import. .TP .B \[en]export\-image name Save an existing Docker image as a file that can be copied elsewhere. If name is not supplied, the user can choose from a menu. .TP .B \[en]import\-image name Import a docker image stored on disk as tar file .TP .B \[en]copy\-config Create a personal DUE configuration file in \[ti]/.config/due/due.config .TP .B \[en]make\-dev\-dir [dir] Populate a local directory for DUE container development. .TP .B \[en]list\-templates List available templates. .TP .B \[en]delete\-matched [term] Delete containers that contain this term. USE WITH CAUTION! .TP .B \[en]docker\-clean Run `docker system prune ; docker image prune' to reclaim disk space. .TP .B \[en]help\-examples Examples of using management options. .SH FILES .TP .B \f[I]/etc/due/due.conf\f[R] Global configuration file .TP .B \f[I]\[ti]/.conf/due/due.conf\f[R] Per\-user default configuration file. Overrides the global one. \f[C]due \-\-manage \-\-copy\-config\f[R] will set that up for the user. .SH ENVIRONMENT .PP The configuration file sets up the following variables: .PP \f[C]DUE_ENV_DEFAULT_HOMEDIR\f[R] \- evaled to define the user\[cq]s home directory. This can be useful if there is a naming convention for work directories on shared systems, or your home directory is an NFS mount (which can create .PD 0 .P .PD strange behavior when mounted in Docker) or you need to use a bigger build directory. .PP \f[C]DUE_USER_CONTAINER_LIMIT\f[R] \- limit the number of containers a user is allowed to run. Handy on a shared system to remind people of what they have running. This can easily be circumvented, though. .SH BUGS .PP See GitHub Issues: [https://github.com/[CumulusNetworks]/[DUE]/issues] .SH AUTHOR .PP Alex Doyle .SH COPYRIGHT .PP SPDX\-License\-Identifier: MIT .PP Copyright (c) 2019,2020 Cumulus Networks, Inc. .PP Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \[lq]Software\[rq]), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: .PP The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. .PP THE SOFTWARE IS PROVIDED \[lq]AS IS\[rq], WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .SH SEE ALSO .PP \f[B]due.conf(4)\f[R]