Enjoy Slackware 15.0!
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
howtos:misc:lxc [2018/09/14 05:11 (UTC)] montagdude |
howtos:misc:lxc [2018/10/19 22:00 (UTC)] mralk3 |
||
---|---|---|---|
Line 4: | Line 4: | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | Linux Containers, or LXC, is operating system-level method for running multiple separate isolated Linux installations (containers) on a single host. Rather than simulating the computer hardware as in true virtualization, | + | Linux Containers, or LXC, is operating system-level method for running multiple separate isolated Linux installations (containers) on a single host. Rather than simulating the computer hardware as in true virtualization, |
===== Setting up a Network Bridge ===== | ===== Setting up a Network Bridge ===== | ||
Line 36: | Line 36: | ||
</ | </ | ||
- | The name of the bridge, gateway, netmask, and many other parameters can be modified in / | + | The name of the bridge, gateway, netmask, and many other parameters can be modified |
To actually use this network within the container, there are a few steps that will need to be taken during the initial creation and setup of the container, which will be covered in the next section. | To actually use this network within the container, there are a few steps that will need to be taken during the initial creation and setup of the container, which will be covered in the next section. | ||
Line 76: | Line 76: | ||
</ | </ | ||
- | When lxc-create is created, the container will be created at lxcpath/ | + | When lxc-create is executed, the container will be created at $lxcpath/ |
===== Container Configuration ===== | ===== Container Configuration ===== | ||
- | ==== Logging In ==== | + | After creating the container, you are almost ready to go. First start the container: |
+ | |||
+ | < | ||
+ | lxc-start -n container_name | ||
+ | </ | ||
+ | |||
+ | To log in, use: | ||
+ | |||
+ | < | ||
+ | lxc-console -n container_name | ||
+ | </ | ||
+ | |||
+ | or | ||
+ | |||
+ | < | ||
+ | lxc-attach -n container_name | ||
+ | </ | ||
+ | |||
+ | The first variant will give you a login console on the container, whereas the second will just give you a root shell without asking for a password. The first thing to do is to create a new user; use the standard Slackware tools such as // | ||
==== Network ==== | ==== Network ==== | ||
+ | |||
+ | Even if you successfully set up a bridge network on the host and configured your container to use a virtual ethernet interface as described above, at this point you will probably still not have network access in the container. The reason is that you still need to set up your container' | ||
+ | |||
+ | < | ||
+ | USE_DHCP[0]=" | ||
+ | </ | ||
+ | |||
+ | If desired, it should be possible to use a static IP address in the container as well. | ||
+ | |||
+ | <note tip> | ||
+ | The minimal Slackware installation set up by lxc-create does not have a lot of choice in editors, but //vi// (symlink to //elvis//) is available. If that's not your cup of tea, you can always edit the container' | ||
+ | </ | ||
+ | |||
+ | Once you have edited / | ||
+ | |||
+ | < | ||
+ | lxc-stop -n container_name | ||
+ | lxc-start -n container_name | ||
+ | </ | ||
+ | |||
+ | Wait a minute or so to give the container plenty of time to " | ||
+ | |||
+ | < | ||
+ | # lxc-ls --fancy | ||
+ | NAME STATE | ||
+ | Slackware-14.2 | ||
+ | Slackware64-14.2 | ||
+ | Slackware64-current STOPPED 0 | ||
+ | </ | ||
+ | |||
+ | If the container successfully connected to the network, you should see that an IP address has been assigned. Log into the container again, and you should be able to ping outside, use slackpkg, etc. At this point, you can install any additional software you desire on the container. If you are using the container as a build environment, | ||
+ | |||
+ | < | ||
+ | slackpkg install slackware | ||
+ | </ | ||
+ | |||
+ | or | ||
+ | |||
+ | < | ||
+ | slackpkg install slackware64 | ||
+ | </ | ||
+ | |||
+ | ==== Custom Container Boot Process ==== | ||
+ | |||
+ | In order to customize the boot process you can add or modify the init scripts listed in **/ | ||
==== Sharing Directories with the Host ==== | ==== Sharing Directories with the Host ==== | ||
- | ===== Checking Container Status | + | Because an LXC container' |
+ | |||
+ | < | ||
+ | lxc.mount.entry | ||
+ | </ | ||
+ | |||
+ | Note that the second path intentionally lacks a leading slash. This is because it is a relative path -- relative to the container' | ||
+ | |||
+ | ====== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
====== Sources ====== | ====== Sources ====== | ||
Line 92: | Line 171: | ||
<!-- * Original source: [[http:// | <!-- * Original source: [[http:// | ||
<!-- Authors are allowed to give credit to themselves! --> | <!-- Authors are allowed to give credit to themselves! --> | ||
- | < | + | * Originally written by [[wiki: |
<!-- * Contributions by [[wiki: | <!-- * Contributions by [[wiki: | ||