Uncategories

Ubuntu Container

To list the container:
lxc list

To create the container:
lxc launch ubuntu:16.04 sensu

To access the container:
lxc exec sensu bash

To stop the container:
lxc stop sensu

To start the container:
lxc start sensu

To delete the container (must stop first):
lxc stop sensu
lxc delete sensu

To pull (copy) file from container to host:
lxc file pull <container(source)> <host(destination)>
lxc file pull sensu/tmp/ssl_certs.tar /tmp

To push file from host to container:
lxc push file
lxc file push ssl2.tar sensu/tmp/

To get info about the container:
lxc info sensu

To rename the container:
lxc stop sensu
lxc move sensu sensuold

before:
oriori2

after:
new2new

To snapshot the container:
lxc snapshot sensu YYYY-MM-DD

To copy/clone the container:
lxc copy sensu sensu2

To copy/clone the snapshot:
lxc copy sensu/02102016 sensu3

Default location container:
/var/lib/lxd/containers

To list folder under containers:
sudo ls -lh /var/lib/lxd/containers

Default location snapshot:
sudo ls -lh /var/lib/lxd/snapshots

Access File
———

Using container:
lxc exec sensu bash
cd /etc/sensu

Direct Access: (/var/lib/lxd/containers/sensu/rootfs/etc/sensu)
cd /var/lib/lxd/containers/
sudo ls -lh
cd /sensu/rootfs/etc/sensu

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s