Man page - due(1)
Packages contains this manual
Manual
DUE
NAMESYNOPSIS
DESCRIPTION
Functional Options
ârun options
Starting an image
Logging in to a running container
âcreate options
Creation Overview
Creation tips
Advanced image creation
Creation example
âmanage options
FILES
ENVIRONMENT
BUGS
AUTHOR
COPYRIGHT
SEE ALSO
NAME
due - Dedicated User Environment. A build environment for your build environments.
SYNOPSIS
due
[
-r|ârun
args
] [
dedication
]
due
[
âcreate
args
]
[
dedication
]
due
[
âdelete
term
]
[
dedication
]
due
[
-m
|
âmanage
args
]
[
dedication
]
due
[
-v
|
âversion
]
due
[
-h
|
âhelp
]
DESCRIPTION
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.
Key features include:
1 - Creating an account in the container for the user at run time and mounting the userâs home/work directory so configuration files are available.
2 - List based browsing of images to run and active containers to log in to.
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.
4 - Commands can be run using the container without having to log into it, allowing for use in automated build environments.
5 - Compatibility with both Docker and Podman for running containers.
Functional Options
Each of these
options has context specific help and sub commands
-r, ârun
Start new containers.
âbuild, âduebuild
Execute containerâs /usr/local/bin/duebuild script in current directory. See the ârun section for more.
âcreate
Make and configure new Docker images.
âdelete
Delete existing Docker images that match the term.
-m, âmanage
Manipulate and query existing images.
-h, âhelp
Usage information.
-v, âversion
Print DUEâs version number.
ârun options
These options are available after the ârun argument, and relate to starting and logging in to containers.
Starting an image
-i, â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.
-a, â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 âusername and âuserid (usually âusername root and âuserid 0. See below )
âignore-type
When accessing the container, do not attempt to create a user
account for the user logging in, and assume the container was not created by DUE. This can be useful with image creation debug.
-c, âcommand [cmd]
Run [cmd] in the container using the â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 "" 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.
Example: look at /proc and the
password file in a container: ./due ârun
âcommand âls -lrt /procâ ; âcat
/etc/passwdâ
âbuild | â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âs duebuild script. For more information, check the template/README.md for the image type, or use: due âduebuild âhelp to select a container and get its duebuild scriptâs help options directly.
âduebuild
Same behavior as âbuild, but a bit clearer that it is working with the selected containerâs duebuild script. One notable difference is that due âduebuild âhelp will select a container and execute duebuild âhelp to see the options provided by that particular script.
âdockerarg [arg]
Put [arg] in the docker run invocation. For multiple arguments, use multiple invocations of âdockerarg. This allows for things like running containers with âprivileged
|
âdebug |
Sets defaults of âusername root âuserid 0 and the âany option to show images that were not created by DUE. Helpful for internal debug if image creation dies running internal configuration scripts. |
â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âs âlogin option unless âall is also provided. This may or may not be desirable behavior.
âhome-dir [host path]
Absolute path to a directory to use as the home directory when the user logs in. Defaults to the userâs home directory unless overridden with this argument, or set otherwise in /etc/due/due.conf, or ~/config/due/due.conf
â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 âmount-dir commands can be used in a single invocation. Example: mount host /tmp dir in container /var/build: âmount-dir /tmp/:var/build
Logging in to a running container
-l, âlogin
Choose an existing container to log in to.
âusername [username]
Name to use when logging in.
âuserid [id#]
User ID to use when logging in.
âgroupname [groupname]
Container userâs default group
âgroupid [id#]
ID of container userâs group
âlogin-shell [path]
Program to use as login
âhelp-runtime
Invoke runtime help
âhelp-runtime-examples
Show examples of use
âcreate options
These options are accessed after the âcreate argument, and, predictably enough, relate to creating new images.
Creation Overview
Containers created by DUE will always have files from ./templates/common-templates in every image. The primary example of this is the container-create-user.sh 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.
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â
1 - The contents
of common-templates are copied to a
debian-package-10-template-merge directory under
./due-build-merge/
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.
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
4 - The
./due-build-merge/debian-package-10/Dockerfile.create file
is used to create the image from this build directory.
Creation tips
Quick image changes can be made by editing the build directory ( ./due-build-merge/debian-package-10 ) and re running ./due âcreate âbuild-dir ./due-build-merge/debian-package-10
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.
A list of available default configurations is provided by running: due âcreate âhelp This will parse the README.md files under the ./templates directory looking for specific strings. This output can be filtered by using wildcard syntax as follows: due âcreate âhelp âfilter
Advanced image creation
DUE 3.0.0 introduced hierarchical template parsing, where a template could be a combination of files provided by âsub-typeâ directories, to reduce file duplication. With this, files with identical names and paths will overwrite the ones provided by higher directories.
Example: Given directory structure: due/templates/foo/sub-type/bar/sub-type/baz
Image creation using the âbazâ template will be: 1 - files from templates/common-templates 2 - plus files from foo overwriting any files with the same relative path from common-templates 3 - plus files from bar overwriting foo files the same way 4 - plus files from baz overwriting bar files the same way.
While not normally needed, this may be useful for supporting a number of Images with minor but important differences. See templates/README.md for more information.
Creation example
1 - Configure an
image build directory under due-build-merge named from
âname Mandatory:
âfrom [name:tag]
Pull name:tag from registry to use as starting point for the image.
âuse-template [role]
Use files from templates/[role] to generate the config directory.
âdescription âdescâ
Quoted string to describe the container on login.
âname name
Name for resulting image and config directory. Ex: debian-stretch-build, ubuntu-18.04-build, etc
Optional:
âprompt [prompt]
Set in container prompt to [prompt] to provide user context
âno-image
With âcreate, allow directories to be created, but do not try to build the image. Effectively stops use of âdir. Useful for debugging directory configuration issues.
âfilter [term]
With âcreate âhelp, filter examples to contain [term].
2 - Build a
Docker image from the image build directory.
âdir [dirname]
Build using an existing configuration directory.
|
âclean |
Delete the due-build-merge staging directories. |
âmanage options
These options
are accessed after the âmanage argument, and can make
working with containers/images easier.
-l, âlist-images
List images created by DUE.
|
âstop |
Use the menu interface to stop a running container. Works with âall to show containers not started by the user. If is supplied, it will match all the userâs containers to that pattern and produce a script that can be edited and run to delete the listed containers. NOTE: âall â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. |
â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 âimport.
â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.
âimport-image name
Import a docker image stored on disk as tar file
âcopy-config
Create a personal DUE configuration file in ~/.config/due/due.config
âmake-dev-dir [dir]
Populate a local directory for DUE container development.
âlist-templates
List available templates.
âdelete-matched [term]
Delete containers that contain this term. USE WITH CAUTION!
âdocker-clean
Run âdocker system prune ; docker image pruneâ to reclaim disk space.
âhelp-examples
Examples of using management options.
FILES
/etc/due/due.conf
Global configuration file
~/.conf/due/due.conf
Per-user default configuration file. Overrides the global one. due --manage --copy-config will set that up for the user.
ENVIRONMENT
The configuration file sets up the following variables:
DUE_ENV_DEFAULT_HOMEDIR
- evaled to define the userâ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
strange behavior when mounted in Docker) or you need to use
a bigger build directory.
DUE_USER_CONTAINER_LIMIT - 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.
BUGS
See GitHub Issues: [https://github.com/[CumulusNetworks]/[DUE]/issues]
AUTHOR
Alex Doyle <adoyle@nvidia.com>
COPYRIGHT
SPDX-License-Identifier: MIT
Copyright (c)
2021 Nivia Corporation.
Copyright (c) 2019,2020 Cumulus Networks, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the âSoftwareâ), 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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED âAS ISâ, 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.
SEE ALSO
due.conf(4)