Giter VIP home page Giter VIP logo

lxd's Introduction

LXD

LXD is a modern, secure and powerful system container and virtual machine manager.

It provides a unified experience for running and managing full Linux systems inside containers or virtual machines. LXD supports images for a large number of Linux distributions (official Ubuntu images and images provided by the community) and is built around a very powerful, yet pretty simple, REST API. LXD scales from one instance on a single machine to a cluster in a full data center rack, making it suitable for running workloads both for development and in production.

LXD allows you to easily set up a system that feels like a small private cloud. You can run any type of workload in an efficient way while keeping your resources optimized.

You should consider using LXD if you want to containerize different environments or run virtual machines, or in general run and manage your infrastructure in a cost-effective way.

Get started

See Getting started in the LXD documentation for installation instructions and first steps.

Status

Type Service Status
Tests GitHub Build Status
Go documentation Godoc GoDoc
Static analysis GoReport Go Report Card
Translations Weblate Translation status

Installing LXD from packages

The LXD daemon only works on Linux but the client tool (lxc) is available on most platforms.

OS Format Command
Linux Snap snap install lxd
Windows Chocolatey choco install lxc
macOS Homebrew brew install lxc

The LXD snap packaging repository is available here.

For more instructions on installing LXD for a wide variety of Linux distributions and operating systems, and to install LXD from source, see How to install LXD in the documentation.

Client SDK packages

The LXD project provides SDK client packages for interacting with LXD servers from your own software.

These SDKs are licensed as Apache-2.0.

Language URL
Go https://pkg.go.dev/github.com/canonical/lxd/client
Python https://github.com/canonical/pylxd

For more information on using the LXD API, see REST API in the documentation.

Tools for managing LXD

If you are looking for tools (beyond lxc CLI) to manage LXD at scale (from single server to wide clusters), the following projects can be useful:

Tool Link
Ansible - connection plugin https://galaxy.ansible.com/ui/repo/published/community/general/content/connection/lxd/
Ansible - inventory plugin https://galaxy.ansible.com/ui/repo/published/community/general/content/inventory/lxd/
Bolt - LXD transport https://www.puppet.com/docs/bolt/latest/bolt_transports_reference.html#lxd
MicroCloud https://canonical.com/microcloud
Packer - LXD builder https://developer.hashicorp.com/packer/integrations/hashicorp/lxd/latest/components/builder/lxd
Terraform provider https://registry.terraform.io/providers/terraform-lxd/lxd

Security

Consider the following aspects to ensure that your LXD installation is secure:

  • Keep your operating system up-to-date and install all available security patches.
  • Use only supported LXD versions (LTS releases or monthly feature releases).
  • Restrict access to the LXD daemon and the remote API.
  • Configure your network interfaces to be secure.
  • Do not use privileged containers unless required. If you use privileged containers, put appropriate security measures in place. See Container security for more information.

See Security for detailed information.

IMPORTANT:

Local access to LXD through the Unix socket always grants full access to LXD. This includes the ability to attach file system paths or devices to any instance as well as tweak the security features on any instance.

Therefore, you should only give such access to users who you'd trust with root access to your system.

Support and community

The following channels are available for you to interact with the LXD community.

Bug reports

You can file bug reports and feature requests at: https://github.com/canonical/lxd/issues/new

Forum

A discussion forum is available at: https://discourse.ubuntu.com/c/lxd/

IRC

If you prefer live discussions, you can find us in #lxd on irc.libera.chat. See Getting started with IRC if needed.

Commercial support

Commercial support for LXD is available through Ubuntu Pro (Ubuntu Pro (Infra-only) or full Ubuntu Pro). The support covers all LTS versions for five years starting from the day of the release.

See the full service description for detailed information about what support Ubuntu Pro provides.

Documentation

The official documentation is available at: https://documentation.ubuntu.com/lxd/en/latest/

You can find additional resources on the website, on YouTube and in the Tutorials section in the forum.

Contributing

Fixes and new features are greatly appreciated. Make sure to read our contributing guidelines first!

lxd's People

Contributors

brauner avatar chrisglass avatar ctrlrsf avatar dependabot[bot] avatar dnegreira avatar freeekanayaka avatar gabrielmougard avatar hallyn avatar hamistao avatar hnakamur avatar jochumdev avatar juneezee avatar markylaing avatar masnax avatar mggmuggins avatar mihalicyn avatar mikemccracken avatar monstermunchkin avatar musicdin avatar presztak avatar roosterfish avatar ru-fu avatar simondeziel avatar stgraber avatar tarruda avatar techtonik avatar tenforward avatar tomponline avatar tych0 avatar weblate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lxd's Issues

Compile Error ../container.go:25: undefined: lxc.StateMap

getting compile error

vagrant@vagrant-ubuntu-trusty-32:~/go/src/github.com/lxc/lxd$ make 
make -C lxc
make[1]: Entering directory `/home/vagrant/go/src/github.com/lxc/lxd/lxc'
go build
# github.com/lxc/lxd
../container.go:25: undefined: lxc.StateMap

Replace sha256 by scrypt or bcrypt

Current standard seems to be to use the CPU intensive bcrypt or CPU+MEM intensive scrypt instead of faster hashing methods for password.

Implement SSL/certificates support

Currently lxd supports a temporary non-ssl http:// channel.

The proper use of certificates must be implemented so that https+lxd:// can be used, and http:// dropped.

Don't call syscalls directly, use C and libc wrapper

syscalls aren't guaranteed to be stable across architectures. That's what we have a C library for, so rather than call them directly, when Go doesn't provide the right interface we should just do it through C.

Set some default remotes

On a system that has lxd installed, on first start of lxc, the following remotes should be added:

  • local -> unix+lxd://var/lib/lxd/socket
  • images -> https+registry://registry.linuxcontainers.org

In this case, the local remote should be marked as the default.

On a system with only lxc installed and no daemon, only the images remote should be added on first start.

In this case, no remotes should be set as default and the first one added by the user should then be marked as the default.

Implement the local image server

This issue is to track the implementation of the /1.0/images API as well as its command line.

This part of the API and command line tool deals with turning existing containers or snapshots into an image that other hosts can consume. Images are to be exported in a compressed format (xz) and available either publicly (guest REST) or privately (authenticated REST).

Support for translations

I think it's pretty important to support translations for the client tool.

As such, we should make sure that we do not hardcode strings in the API unless those are inherited from a lower layer (console output of the container, LXC debug output, ...). Instead, error codes should be used so that they can then be displayed in the relevant language on the client side.

The strings in the client should all be using gettext with C being American English, therefore allowing contributors to provide translations for their own language.

I'm marking this release critical because we need to make sure we think about this in the design and use gettext wrapped strings everywhere. We will never block a release on missing strings in any given language.

Fix armhf, ppc64el and arm64 support

Currently LXD fails to build on all three of those architectures.

armhf:

  • Fails because of uname type

ppc64el:

  • Fails because of uname type
  • Missing definition of the BTRFS magic number

arm64:

  • Fails because of uname type
  • Missing definition of the BTRFS magic number

The uname failure is typically:

 dist/src/github.com/lxc/lxd/lxd/api10.go:92: cannot use uname.Release (type [65]uint8) as type [65]int8 in argument to CharsToString

As can be seen on armhf here:
https://launchpadlibrarian.net/198024883/buildlog_ubuntu-vivid-armhf.lxd_0.1-0ubuntu1_FAILEDTOBUILD.txt.gz

Ensure every code path generates a response

Right now, as far as I know every code path writes a valid lxd response. However, since our Command API doesn't force methods to return anything, we really have no way of enforcing this. We should invent some Response type thunk that knows how to generate the right response and return that, thus forcing each code path to generate a real response (and also getting rid of a bunch of ugly blank returns everywhere).

typo in lxd/specs/rest-api.md

The line 80 and 81 in ./specs/rest-api.md are the same (except intendation).

Is something missing from line 81 or can it be removed?

Implement ETAG in the API

All get operations should return an etag which is tied to the static status of the resource (so the etag for a container should change if its config changes but not if its status does) and any change operation providing an etag will have that etag checked against the current one with the change only being applied if they do.

This is to avoid the case where the configuration changed between the time it's grabbed and the time it's pushed back (such as having two clients doing the same operation).

ETAG is an HTTP standard initially designed for web caching.

lxc config trust dumps stack

Exploring the cli, I ran lxc config trust and it dumped stack.

Reproduce:

  1. get lxd, deps and build it with make, then run
    ~/go/bin/lxd --debug --tcp 127.0.0.1:8443
  2. ~/go/bin/lxc config trust

Error Output:
% ~/go/bin/lxc config trust
panic: runtime error: index out of range

goroutine 16 [running]:
runtime.panic(0x736880, 0xb2db9c)
/usr/lib/go/src/pkg/runtime/panic.c:279 +0xf5
main.(*configCmd).run(0xc208000c10, 0xc20804c340, 0xc208000c80, 0x1, 0x1, 0x0, 0x0)
/home/rharper/go/src/github.com/lxc/lxd/lxc/config.go:52 +0xf88
main.run(0x0, 0x0)
/home/rharper/go/src/github.com/lxc/lxd/lxc/main.go:63 +0x74e
main.main()
/home/rharper/go/src/github.com/lxc/lxd/lxc/main.go:15 +0x26

goroutine 19 [finalizer wait]:
runtime.park(0x420990, 0xb43230, 0xb2fe49)
/usr/lib/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0xb43230, 0xb2fe49)
/usr/lib/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
/usr/lib/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
/usr/lib/go/src/pkg/runtime/proc.c:1445

goroutine 17 [syscall]:
runtime.goexit()
/usr/lib/go/src/pkg/runtime/proc.c:1445

resp.TLS undefined

go get -v github.com/lxc/lxd/...
github.com/lxc/lxd
# github.com/lxc/lxd
./client.go:240: resp.TLS undefined (type *http.Response has no field or method TLS)
./client.go:241: resp.TLS undefined (type *http.Response has no field or method TLS)
./client.go:246: resp.TLS undefined (type *http.Response has no field or method TLS)
./client.go:247: resp.TLS undefined (type *http.Response has no field or method TLS)
./client.go:248: resp.TLS undefined (type *http.Response has no field or method TLS)

Using 16765fa from master

freeze/unfreeze should be an API-only function for now

I believe we agreed that freeze/unfreeze wasn't very likely to be useful to the normal user and that those were likely to be more confusing than anything else. So while they do make a lot of sense in the API, we shouldn't have them in the client tool at this point.

Add support for profiles

This includes implementing the /1.0/profiles API to create/query/modify/delete profiles as well as being able to add/remove profiles from containers.

This also includes the "lxc config profile" commands.

Support custom id mapping

It'd be nice if we had a way to turn profiles into security groups which would then setup the appropriate apparmor rules and use different uid/gid maps to properly isolate those containers.

Implement container configuration

This includes:

  • Update the REST API to match the spec wrt "config" and "devices"
  • Implement the "lxc config devices" commands
  • Implement the "lxc config edit" command

Use "go get" and "go install" instead of separate Makefiles (but keep the main Makefile)

I think instead of using "make" we should suggest using more go-like approach for "Building the tools" section. Maybe something like this;

[root@eleksi:~] mkdir go
[root@eleksi:~] export GOPATH=/root/go
[root@eleksi:~] go get github.com/lxc/lxd/lxc
[root@eleksi:~] go get github.com/lxc/lxd/lxd
[root@eleksi:~] ls go/bin/
lxc  lxd
[root@eleksi:~]

I could send a pull request if you are OK with this "go get" way.

suggestion: make remote sub-command simple and clean

Hi all, I think that lxc remote just need to do some simple jobs as in git remote, instead of bothering itself with some cert things, which should be put to some other place.

Here's my reason:

  1. lxc remote add needs time (at least after a successful '/ping' and possibly '/trust/add') to finish its work, which can be time consuming under certain conditions. Also note that one can remove this client cert from lxd server anytime they want.

  2. consider this, the container will be started on www.example.com? (line 242 of client.go)

    $ lxc remote add myhost www.example.com
    $ lxc remote set-default myhost
    $ lxc remote rename myhost unix:whatever    # weird name, but it's right, for now
    $ lxc start container
    
  3. Moreover, people can change the config file $HOME/.lxd/config.yaml to anything, as long as it is legal, literally.

So we should not totally rely on Config, and also not try to do some initial stuff or check it's correctness too early! It only adds complexity.

In my opinion, lxc remote just need to check if the argument is invalid or duplicated, then add/remove/rename on the map. Other jobs like '/ping', '/trust/add' ... be done only when requested or needed.

Implement support for image stores

Container creation currently only works for ubuntu trusty containers using the download template.

In order to properly support container creation, we'll need image stores.

Please see the specs document for details.

need a spec for profiles

We need a spec for profiles, in particular:

  • what meta-keys are we going to allow? e.g. resources.memory = 25%
  • we're storing these in a DB (i.e. not in the LXC config file), so what does the schema look like (this is probably pretty simple)
  • what happens if someone sets a lxc.foo key instead of one of our predefined ones above? I guess we want to provide some way to set (and get?) arbitrary lxc.* keys, perhaps it is via this mechanism.

Incomplete documentation for getting the project running.

Running from stock ubuntu 14.04, with git and go installed.

The commands I followed from stock:

trusty-64:~$ sudo apt-get -y install git golang > /dev/null
trusty-64:~$ mkdir -p ~/sources/bin
trusty-64:~$ export GOPATH=~/sources
trusty-64:~$ export GOBIN=$GOPATH/bin
trusty-64:~$ go get github.com/lxc/lxd
trusty-64:~$ cd $GOPATH/src/github.com/lxc/lxd
trusty-64:~/sources/src/github.com/lxc/lxd$ go build
trusty-64:~/sources/src/github.com/lxc/lxd$ ????
trusty-64:~/sources/src/github.com/lxc/lxd$ go build -x
WORK=/tmp/go-build043807985

the last command being explicit with what go build is doing, which is defining a variable called WORK and then doing nothing.

I would expect running go get ../... at some point or installing pkg-config

and presumably LXC should be on the system as well? sudo apt-get install lxc ?

or compile from source?

lxc create doesn't exist

Following the guide in the readme.md. After installing via the ppa on 14.04 and with the lxd daemon running the lxc create foo just lists the -h output which also doesn't include a create.

We need tests

In order to make sure things don't regress, we should introduce a testsuite as soon as possible which tests the various bits of the REST API.

Where that makes sense, we should also have scripts to sanity check our code.

The testsuite would be run on Jenkins where we can actually start containers, the sanity check scripts would be run by Travis so pull requests that do not pass are marked appropriately.

Can't make lxd

Reproduce steps on trusty amd64 host:

  1. export GOPATH=$HOME/go
  2. go get github.com/lxc/lxd
  3. cd $GOPATH/src/github.com/lxc/lxd
  4. go get -v -d ./...
  5. make

Error Output:

% make
go install -v ./...
github.com/lxc/lxd
github.com/lxc/lxd/fuidshift
github.com/lxc/lxd/internal/gnuflag
golang.org/x/crypto/ssh/terminal
# github.com/lxc/lxd
./client.go:223: resp.TLS undefined (type *http.Response has no field or method TLS)
./client.go:224: resp.TLS undefined (type *http.Response has no field or method TLS)
./client.go:229: resp.TLS undefined (type *http.Response has no field or method TLS)
./client.go:230: resp.TLS undefined (type *http.Response has no field or method TLS)
./client.go:231: resp.TLS undefined (type *http.Response has no field or method TLS)
code.google.com/p/go-uuid/uuid
github.com/dustinkirkland/golang-petname
github.com/gorilla/context
github.com/gorilla/mux
github.com/kr/pty
golang.org/x/crypto/pbkdf2
golang.org/x/crypto/scrypt
gopkg.in/tomb.v2
make: *** [default] Error 2
(foudres) lxd % echo $?
2

lxd can only be ^C'd until a container has started

After a container starts (even if that container is stopped), lxd can't be ^C'd. We should probably either not allow it at all, or allow it always and kill all the containers if it is ^C'd. I prefer the second option.

need API spec for restoring snapshots

Right now there's no way to implement the restore command using the rest API, since it doesn't describe how to restore containers from snapshots.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.