Repository navigation
tabc can now save a running container to a file and start new containers from the file (#9). The program does not start again. It carries on in the same process, about a second after the command.
$ tabc run --name api -v "$PWD":/app my-api # slow to start
$ tabc park api warm.snap # saved; api runs on
$ tabc restore --name api-2 -p 8081:8080 -v ~/other:/app warm.snap@pabloprx brought the use case and the first version of restore. His app is four containers that take about 200 s to start cold, and by his measurement 8 to 10 s as a copy of a warm one.
Park and restore
tabc park <container> <file>saves the guest and the container runs on, so you can save as often as you like.--stopends the container once the file is written.tabc restore <file>starts a new container from the file. The image, command, environment, terminal, memory and CPUs come from the file. The flags say only where the new container stands:--name,-p,--network,--network-aliasand-v dir:/path.- Told nothing, the new container is the saved one again, with the same name, ports and volumes: a container put to sleep and woken. Given its own name, ports and directories, it is a copy beside the first.
- Any container can be parked, with or without
-t. A program without a terminal keeps its three pipes, so stderr stays apart from stdout and piped input still ends. tabc park <container>with no file moves a container you have open in a browser tab (--open,--link) to another tab: the guest stops, and the next browser to open its page resumes it.
A snapshot of a shell loop in Alpine is about 43 MiB and takes about 30 ms to take. A restore of it prints its next line about a second after the command, which is also what a cold tabc run alpine echo hi takes, so what you gain is whatever your program spends warming up.
What to know
- A snapshot file holds the program's memory and its environment, secrets included. It is written readable by you alone.
- Connections do not survive. Sockets that were open when the guest was saved are reset in the restored guest. A server keeps its listening socket and accepts new connections.
- Programs started with
tabc execare not in the restored container. - A volume's files are not in the snapshot. A restore finds the volume as the host has it now.
- Each restored guest reseeds its kernel's random numbers. A program that seeded a generator of its own before the save has the same seed in every copy.
- A program without a terminal is kept through a restore by a change to unkernel that tabc's build carries as a patch, until an unkernel release has pithings/unkernel#102.
Testing is thin so far. CI saves a container, stops it, and restores it with its volume in another directory, on Linux x86-64 only. Park and restore have not been run on macOS or Windows in this form, so please file an issue if one of them breaks.
docs/design.md covers how it works.
Other changes
tabc run --network-alias <name>gives a container one more name on its networks, likedocker run --network-alias. Thanks @pabloprx (#6).- On macOS, headless runs no longer hang while the screen is locked. Chrome was waiting on the Keychain. Also from @pabloprx (#8).
- Hard links now work in a container's volumes. This release picks up the unkernel that includes pithings/unkernel#46.
Full changelog: v1.1.0...v1.2.0