GithubHelp home page GithubHelp logo

simhaonline / lxdfile Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hverr/lxdfile

0.0 0.0 0.0 78 KB

A Dockerfile-like file format for LXD containers

License: GNU General Public License v3.0

Haskell 99.04% Shell 0.96%

lxdfile's Introduction

lxdfile

A Dockerfile-like file format for LXD containers.

Manage LXD containers using a Dockerfile-like file format, with support to store metadata.

Installing

Download the latest release, or use

stack build
stack exec lxdfile -- -h

Usage

Example lxdfiles can be found in lxdfile-examples.

Using lxdfiles to power LXD containers involves two steps:

  1. Build the reusable image using lxdfile build
  2. Launch a container using a prebuilt image using lxdfile launch

Building images

Take for example the gogs example.

Running lxdfile build gogs will create an image in your local LXD image repository

$ lxc image list local:
+-------------------------+--------------+--------+---------------------------------------+--------+----------+------------------------------+
|          ALIAS          | FINGERPRINT  | PUBLIC |              DESCRIPTION              |  ARCH  |   SIZE   |         UPLOAD DATE          |
+-------------------------+--------------+--------+---------------------------------------+--------+----------+------------------------------+
| gogs                    | 6199407c377b | no     | Gogs - Go Git Service                 | x86_64 | 177.56MB | Nov 14, 2016 at 1:56pm (UTC) |
+-------------------------+--------------+--------+---------------------------------------+--------+----------+------------------------------+
| ubuntu/yakkety (3 more) | 16b6d53f6dd1 | no     | Ubuntu yakkety amd64 (20161114_03:49) | x86_64 | 80.20MB  | Nov 14, 2016 at 1:44pm (UTC) |
+-------------------------+--------------+--------+---------------------------------------+--------+----------+------------------------------+

Launching containers

You can launch containers using lxdfile launch, e.g. lxdfile launch gogs gogs.

To configure launched containers, you can use init scripts.

A possible use of init scripts is to configure the network. You can pass multiple init scripts to lxdfile launch using the -i flag. They will be executed in the order they are passed on the command line.

$ cat configure-network.lxdfile
RUN echo "iface lan inet dhcp" > /etc/network/interfaces
RUN chmod 0600 /etc/network/interfaces

$ lxdfile launch gogs gogs -i configure-network

These configuration scripts can be container-specific or reusable for multiple images. They should be included in source control.

Metadata

Container and image metadata is stored in /etc/lxdfile. It contains JSON representations of the used lxdfile and the used init scripts.

lxdfile's People

Contributors

hverr avatar

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.