Skip to content

Latest commit

 

History

History
70 lines (50 loc) · 1.75 KB

Linux-containers.md

File metadata and controls

70 lines (50 loc) · 1.75 KB

Linux containers

In linux you have containers, with them you can have multiple linux distros without taking performance hits.

LXC

lxc its a method to create containers in linux.

Instructions

lxd is a manager for containers via lxc.

#Install with (it will install needed dependencies like the lxc):

# for arch
pacman -S lxd


# then you search for you distrubution
#for ubuntu you can do:
lxc image list ubuntu:
#and for others you can list with
lxc image list images:
#and it will give you a list of containers
#you can filter them with grep

# after um find what you need you can install it with the launch
# for exemple you can install archlinux with
lxc launch images:archlinux
# debian with
lxc launch images:debian/sid
#and ubuntu with
lxc launch ubuntu:20.04
# it will give you a name you change it with the move command if want to

#for using the console use the
lxc exec <name-of-the-container> bash

#for setting up an shared folder
lxc config device add <container-name> vartest disk source=$(pwd)/debian-shared path=/mnt/host
# and for all users to use it
lxc config set <container-name> security.nesting true
# and restart it with
lxc restart <container-name>

after that setup ssh

to have ssh and passthrough the Xorg with

ssh -X <user>@<host>

for other stuff visit the lxc and lxd archwikis.

To port forward a container do the following:

lxc config device add container-name myport8443 proxy listen=tcp:0.0.0.0:5555 connect=tcp:127.0.0.1:8443

where the listening port is the port exposed in the host and the connect is the port in the guest.