Giter Club home page Giter Club logo

packer-plugin-lxc's Introduction

Packer Plugin Lxc

The Lxc multi-component plugin can be used with HashiCorp Packer to create custom images. For the full list of available features for this plugin see docs.

Installation

Using pre-built releases

Using the packer init command

Starting from version 1.7, Packer supports a new packer init command allowing automatic installation of Packer plugins. Read the Packer documentation for more information.

To install this plugin, copy and paste this code into your Packer configuration . Then, run packer init.

packer {
  required_plugins {
    lxc = {
      version = ">= 1.0.0"
      source  = "github.com/hashicorp/lxc"
    }
  }
}

Manual installation

You can find pre-built binary releases of the plugin here. Once you have downloaded the latest archive corresponding to your target OS, uncompress it to retrieve the plugin binary file corresponding to your platform. To install the plugin, please follow the Packer documentation on installing a plugin.

From Sources

If you prefer to build the plugin from sources, clone the GitHub repository locally and run the command go build from the root directory. Upon successful compilation, a packer-plugin-lxc plugin binary file can be found in the root directory. To install the compiled plugin, please follow the official Packer documentation on installing a plugin.

Configuration

For more information on how to configure the plugin, please read the documentation located in the docs/ directory.

Contributing

  • If you think you've found a bug in the code or you have a question regarding the usage of this software, please reach out to us by opening an issue in this GitHub repository.
  • Contributions to this project are welcome: if you want to add a feature or a fix a bug, please do so by opening a Pull Request in this GitHub repository. In case of feature contribution, we kindly ask you to open an issue to discuss it beforehand.

packer-plugin-lxc's People

Contributors

alrs avatar azr avatar calebalbers avatar chrislundquist avatar dependabot[bot] avatar devashish-patel avatar dougm avatar etiennedeneuve avatar hashicorp-copywrite[bot] avatar ironpinguin avatar jasonberanek avatar jescalan avatar ksatirli avatar lbajolet-hashicorp avatar mitchellh avatar modrake avatar mwhooker avatar nywilken avatar paulmey avatar qur avatar smacfarlane avatar swampdragons avatar sylviamoss avatar tdhite avatar thedrow avatar williamb1024 avatar yusungduk avatar zchsh avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packer-plugin-lxc's Issues

Distrobuilder support

Community Note

Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

Using distrobuilder or something based on the internals of distrobuilder to build LXC images.

Use Case(s)

As per LXC documentation, using LXC templates the way it currently seems this plugin is doing is not recommended, and doesn't work very well. Getting LXC Templates to run is not very easy, and in some cases (all my attempts with alpine linux) it doesn't work at all. The official way to do it instead is to use distrobuilder, which constructs a rootfs for the image that can be used to spawn an lxc container from, using the rootfs as a starting point. This would make building lxc containers easier, and wouldn't require having a working LXC template script for each distro, but just the download sources.

Potential configuration

This could be done by using the shared package of the distrobuilder package to download the base rootfs, which can then be used to start up an lxc container, which can then function as it currently does

Potential References

https://github.com/lxc/distrobuilder

https://linuxcontainers.org/distrobuilder/introduction/

Configure rootfs export to not include `rootfs/` in the output .tar.gz

Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.

Community Note

Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

I am using Packer to provision container templates for a Proxmox VE instance, and Proxmox expects that the input .tar.gz file containing the rootfs be "direct", for lack of a better word. That is, /bin/, /dev/, and the like should be at the top level of the archive rather than contained inside of a /rootfs/ folder.

Obviously I can work around this by doing a post-process step, but it's a bit cumbersome. I'd like a way to configure the export step which lets me solve this use case. (I'm assuming this needs to be more general than something to solve this very specific case, but maybe not.)

Use Case(s)

Proxmox containers is my current use case, although I'd not be surprised to learn there is other LXC-based infrastructure that has this same problem.

Potential configuration

Not really sure. Maybe adding a key like this to the builder config?

archive_directory = $containerDir/rootfs

That syntax definitely needs some work.

Potential References

Exporting unprivileged LXC containers fails

This issue was originally opened by @thedrow as hashicorp/packer#6545. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


When the export step is run, it tries to tar the rootfs.
Unfortunately I failed to notice before that it failed due to some of the files in the rootfs belonging to the container's root.
It seems that exporting the container requires us to run sudo. When running sudo you get a prompt which you can't fill since we're not listening to input.
Not sure how to resolve this correctly.

packer lxc failing to create container

This issue was originally opened by @Dialgatrainer02 in hashicorp/packer#12907 and has been migrated to this repository. The original issue description is below.


Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

when i run packer build . i get errors saying it couldnt create the vm

and im unsure why i can create containers using
sudo lxc-create -t download -n packer-test -- -d alpine -a amd64

Reproduction Steps

install lxc
git clone https://github.com/jpancoast/image-builder.git
cd ./image-builder/lxc/examples/alpine
sudo packer init .
sudo chmod +x build.sh
sudo bash build.sh

Packer version

From packer version

Packer v1.10.2-dev

Your version of Packer is out of date! The latest version
is 1.10.2. You can update by downloading from www.packer.io/downloads

Simplified Packer Template

If the file is longer than a few dozen lines, please include the URL to the
gist of the log or use the Github detailed
format

instead of posting it directly in the issue.
git clone https://github.com/jpancoast/image-builder.git this is my first time using packer so just coping a git repo

Operating system and Environment details

OS, Architecture, and any other information you can provide about the
environment.

arch linux (just for testing)
x86_64
packer and lxc on latest versions

Log Fragments and crash.log files

Include appropriate log fragments. If the log is longer than a few dozen lines,
please include the URL to the gist of the log or
use the Github detailed format instead of posting it directly in the issue.
https://gist.github.com/Dialgatrainer02/c28b16d8a7ab72424323b91e3294d38e

Set the env var PACKER_LOG=1 for maximum log detail.

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.