LXC is the well-known and heavily tested low-level Linux container runtime. It is in active development since 2008 and has proven itself in critical production environments world-wide. Some of its core contributors are the same people that helped to implement various well-known containerization features inside the Linux kernel.
This package implements Go bindings for the LXC C API (liblxc).
Type | Service | Status |
---|---|---|
CI (Linux) | Github | |
Go documentation | Godoc | |
Static analysis | GoReport |
This package requires LXC >= 1.0.0 and its development package and their dependencies to be installed. Additionally, go-lxc requires Golang 1.10 or later to work. Following command should install required dependencies on Ubuntu 18.10:
sudo apt update
sudo apt install git golang gcc make liblxc1 liblxc-dev lxc-utils pkg-config
To install it, run:
go get github.com/lxc/go-lxc
To try examples, run:
# cd ~/go/src/github.com/lxc/go-lxc/examples/
# make
==> Running go vet
==> Building ...
...
# create/create
2018/12/27 22:39:27 Creating container...
# start/start
2018/12/27 22:39:39 Starting the container...
2018/12/27 22:39:39 Waiting container to startup networking...
# attach/attach
2018/12/27 22:39:46 AttachShell
root@rubik:/# hostname
rubik
root@rubik:/# exit
exit
2018/12/27 22:39:52 RunCommand
uid=0(root) gid=0(root) groups=0(root)
# stop/stop
2018/12/27 22:39:54 Stopping the container...
# destroy/destroy
2018/12/27 22:39:57 Destroying container...
LXC has always focused on strong backwards compatibility. In fact, the API hasn't been broken from release 1.0.0
onwards. Main LXC is currently at version 2.*.*
.
See the examples directory for some.
Bug reports can be filed at: https://github.com/lxc/go-lxc/issues/new
Fixes and new features are greatly appreciated. We'd love to see go-lxc improve. To contribute to go-lxc;
When you find you need help, the LXC projects provides you with several options.
We maintain an discuss forum at
where you can get support.
You can find support by joining #lxcontainers
on Freenode
.
You can check out one of the two LXC mailing list archives and register if interested: