Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
ptrcnull | 6aeb6621c6 | ||
ptrcnull | ff7ac9ad75 |
17
README.md
17
README.md
|
@ -2,4 +2,19 @@
|
|||
|
||||
> docker but simpler
|
||||
|
||||
Usage: `miniroot -root "/opt/something" -workdir "/usr/src/app" -init "/usr/loacal/bin/npm start"`
|
||||
In contrast to Docker, miniroot **does not**:
|
||||
- have a concept of images and layers
|
||||
- isolate networks
|
||||
- handle volumes or bind mounts
|
||||
- have a central daemon
|
||||
|
||||
It's just a simple tool that utilises namespaces to run applications in a semi-isolated environment.
|
||||
|
||||
### Usage
|
||||
|
||||
- get rootfs (you can use `docker export container_name > export.tar` for that)
|
||||
- extract it somewhere
|
||||
- run miniroot; example:
|
||||
```
|
||||
miniroot -root "/opt/something" -workdir "/usr/src/app" -init "/usr/local/bin/npm start"
|
||||
```
|
||||
|
|
10
main.go
10
main.go
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"syscall"
|
||||
)
|
||||
|
@ -46,6 +47,15 @@ func main() {
|
|||
fmt.Printf("failed to start: %s\n", err)
|
||||
}
|
||||
|
||||
sigs := make(chan os.Signal, 1)
|
||||
go func() {
|
||||
for {
|
||||
_ = <-sigs
|
||||
cmd.Process.Signal(syscall.SIGTERM)
|
||||
}
|
||||
}()
|
||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
err = cmd.Wait()
|
||||
if err != nil {
|
||||
fmt.Printf("process exited with error: %s\n", err)
|
||||
|
|
Loading…
Reference in a new issue