-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
85 lines (48 loc) · 3.87 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
container: Containerization tool written in Python
To start,
1. make folder ~/Containers, and move container into a place in your $PATH
2. Next, run "container init void"
3. Download a Void Linux rootfs and move it into ~/Containers/void/diff
4. Run "container init $CONTAINER" and edit the container-compose.py with the commands to start
5. Once you have prepared your image, run "container start $CONTAINER"
To build, run `mod`
====================Docs=======================
Containerfile:
This is where you list the steps to build the image.
container-compose.py:
This is where you list the steps to run the image.
$CONTAINERS_ROOT:
This is the directory where all containers will be in.
Colon-string:
$A:$B is equivalent to $CONTAINERS_ROOT/$A/diff/$B. If $A$=="root", this is just /$B. In this case, $B$ can be relative to the directory where the command was called from.
Functions (to be used in Containerfile and container-compose.py):
Ps(process) --- If $process is "main", get the PID of the script. If $process is "auxiliary", get the PIDs of all the processes under the chroot. This is mostly for internal use, and should only be used for debugging.
Mount(IN,OUT) --- mount directory on $IN, in $OUT. $IN is a colon-string. $OUT is an absolute path relative to the container.
Copy(IN,OUT) --- copy file/directory from $IN to $OUT. $IN is a colon-string. $OUT is an absolute path relative to the container.
Loop(func,delay) --- Run $func every delay seconds. If $func is a string, it will be treated as a shell command. Otherwise, it will be run as a Python function.
Wait(delay=None) --- if $delay==None, then wait forever, otherwise, wait for the indicated number of seconds
Layer(layer,mode="RO") --- add $layer as an layer to the container. $mode, which can either be 'RO' (for read-only) and 'RW' (for read-write), indicates how it should be mounted. All Layers must be specified at the top of the file.
Base(base) --- Set $base to be the base layer. This is not strictly neccessary (you can use Layer), but can be useful if some Layers have different Bases --- only the first Base specified will be used.
Workdir(work_dir) --- set $work_dir as working directory of container
Env(value) --- set $env as an environment variable(s) in container
User(user) --- set $user as working user. Can either be just user or user:group. You can also pass in numbers for the user and group.
Shell(shell) --- set $shell as shell
Volume(name,path) --- Bind volume $name in the container's Volumes path to $path in container. $name can also refer to other containers with the colon-string syntax.
Port(_from,_to) --- bind port $_from in container to port $_to on host
Run(command="",pipe=False) --- Run $command in container. $pipe indicates whether output should be returned rather than being written to the log file
Note: If you are on Linux, you can enable user and net namespaces with CONTAINER_USER_NAMESPACES=1 and CONTAINER_NET_NAMESPACES=1, respectively (do be aware that net namespaces are slower than on the root ns)
If you do enable CONTAINER_USER_NAMESPACES, you can set up /etc/subuid and /etc/subgid if you want to be able to access other UIDs and GIDs.
Commands:
Start --- runs container-compose.py
Build --- runs Containerfile
Stop --- kills all processes in container
Restart --- stops, then starts the container
Chroot --- runs an interactive shell in the container. If --and-stop, after the chroot is stopped, the container will be stopped. --run=$command allows you to run a specific command without the TTY.
List --- list specified containers
Init --- make new container. Docker support is available if --pull is specified
Edit --- edit container-compose.py
Status --- list status of container ("Started" or "Stopped")
Log --- read log of container
Clean --- delete everything in the container's diff folder
Delete --- deletes the container
Watch --- incrementally show the container's log in the terminal