Last active
September 12, 2017 03:56
-
-
Save kentarosasaki/ad680d98a2155bbe1a09 to your computer and use it in GitHub Desktop.
Docker だけじゃない Containers の世界 ref: http://qiita.com/kentarosasaki/items/b44b5ffb57a69085027e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt-get install lxc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ls /usr/share/lxc/templates/ | |
lxc-alpine lxc-archlinux lxc-centos lxc-debian lxc-fedora lxc-openmandriva lxc-oracle lxc-sshd lxc-ubuntu-cloud | |
lxc-altlinux lxc-busybox lxc-cirros lxc-download lxc-gentoo lxc-opensuse lxc-plamo lxc-ubuntu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo lxc-info -n test-container-101 | |
Name: test-container-101 | |
State: STOPPED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo lxc-info -n test-container-101 | |
Name: test-container-101 | |
State: RUNNING | |
PID: 20434 | |
CPU use: 0.77 seconds | |
BlkIO use: 7.16 MiB | |
Memory use: 13.53 MiB | |
KMem use: 0 bytes | |
Link: vethABI04E | |
TX bytes: 940 bytes | |
RX bytes: 592 bytes | |
Total bytes: 1.50 KiB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo lxc-info -n test-container-101 -c lxc.utsname -c lxc.rootfs | |
lxc.utsname = test-container-101 | |
lxc.rootfs = /var/lib/lxc/test-container-101/rootfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo add-apt-repository ppa:ubuntu-lxc/lxd-git-master | |
$ sudo apt-get update && sudo apt-get -y install lxd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo lxd-images import lxc ubuntu trusty amd64 --alias ubuntu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo lxc image list | |
+--------+--------------+--------+-------------+--------+------------------------------+ | |
| ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCH | UPLOAD DATE | | |
+--------+--------------+--------+-------------+--------+------------------------------+ | |
| ubuntu | 04aac4257341 | no | | x86_64 | Jul 15, 2015 at 1:16pm (UTC) | | |
+--------+--------------+--------+-------------+--------+------------------------------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo lxc launch ubuntu test-container-102 | |
Creating container...done | |
Starting container...done | |
error: saving config file for the container failed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ lxc list | |
+--------------------+---------+------------+------+-----------+-----------+ | |
| NAME | STATE | IPV4 | IPV6 | EPHEMERAL | SNAPSHOTS | | |
+--------------------+---------+------------+------+-----------+-----------+ | |
| test-container-103 | RUNNING | 10.0.3.138 | | NO | 0 | | |
+--------------------+---------+------------+------+-----------+-----------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo lxc-create -t ubuntu -n test-container-101 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/var/lib/lxc/<コンテナ名>/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo ls -F /var/lib/lxc/test-container-101/rootfs/ | |
bin/ boot/ dev/ etc/ home/ lib/ lib64/ media/ mnt/ | |
opt/ proc/ root/ run/ sbin/ srv/ sys/ tmp/ usr/ var/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo lxc-start -n test-container-101 -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo lxc-console -n test-container-101 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The default user is 'ubuntu' with password 'ubuntu'! | |
# Use the 'sudo' command to run tasks as root in the container. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo lxc-shutdown -n test-container-101 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo lxc-ls --fancy | |
NAME STATE IPV4 IPV6 AUTOSTART | |
-------------------------------------------------- | |
test-container-101 STOPPED - - NO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment