Skip to main content

lxc4u

Project description

Warning! This is still a work in progress.

Provides tools for managing LXC in Ubuntu 12.04 and Ubuntu 12.04 Containers. Other containers are not supported (yet?)

  • Creates containers using overlayfs

  • Can handle multiple overlayfs layers

Working examples

Create a container named test1:

import lxc4u

test1_lxc = lxc4u.create('test1')
# Wait a long time...

# Start the container
test1_lxc.start()

Create a container that overlays test1:

import lxc4u

test1_overlay_lxc = lxc4u.create('test1_overlay', base='test1',
                                overlays=['overlay_path'])

# Start the container
test1_overlay_lxc.start()

test1_overlay_lxc.destroy()

Create a container with multiple overlays of test1. The right most overlay is the upper most overlay directory:

import lxc4u

test1_overlay_lxc = lxc4u.create('test1_overlay', base='test1',
                            overlays=['overlay1_path', 'overlay2_path'])

# Start the container
test1_overlay_lxc.start()

These examples have not yet been implemented. Soon!

Starting a container named test1. This assumes lxc is properly configured in your system:

import lxc4u

# Start container
test1_lxc = lxc4u.start('test1')

# Stop container
test1_lxc.stop()
# or lxc4u.stop('test1')

Possible interface examples

Starting an ephemeral container using test1 as a base:

import lxc4u

# Start container
test1_ephemeral_lxc = lxc4u.start('test1', ephemeral=True)

# Stop container
test1_ephemeral_lxc.stop()

Starting an ephemeral container using test1 with static network settings:

import lxc4u

network_settings = dict(
    ip="10.0.3.5",
    gateway="10.0.3.1",
    netmask="255.255.255.0",
    network="10.0.3.0",
)

# Start container
test1_ephemeral_lxc = lxc4u.start('test1', ephemeral=True,
                                static_network=network_settings)

# Stop container
test1_ephemeral_lxc.stop()

Starting an ephemeral container using with a startup command (must be available on the container’s path):

import lxc4u

# Start container
test1_ephemeral_lxc = lxc4u.start('test1', ephemeral=True,
                    startup_command="/usr/local/bin/somecommand")

# Stop container
test1_ephemeral_lxc.stop()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lxc4u-0.0.1.tar.gz (5.8 kB view details)

Uploaded Source

File details

Details for the file lxc4u-0.0.1.tar.gz.

File metadata

  • Download URL: lxc4u-0.0.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for lxc4u-0.0.1.tar.gz
Algorithm Hash digest
SHA256 92d45ffedf4cb6bc213148e4232b7466c925eb6ec257b37a06112220df5658d8
MD5 c7fc1eb6b9d37d5769da32f5922610fd
BLAKE2b-256 a0b47c1028a3f56f29de7d9f5c5235f8ae27249e9b2b2b53964d3c5d3d357014

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page