Giter Club home page Giter Club logo

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

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

Watchers

 avatar  avatar  avatar  avatar  avatar

lxdfile's Issues

Alias WORKDIR to CD

These two seem analogous to each other, based on my reading of the code/some lxdfiles. Are they the same, or is there a case where you'd think CD doesn't apply to WORKDIR?

Issue building

Hi there

When trying to build, I always receive this message

lxdfile: lxc: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)

Any idea what is happening? the lxdfile is in the same directory

Add support for multiple ENV key=value pairs

Judging from the example lxdfiles, this isn't currently possible in the same way it is for a Dockerfile. Would it be possible to add support for this? I'm guessing this block needs to maybe do some sort of recursive result parsing?

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.