Difference between KVM and LXC

Text from https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/7-Beta/html/Resource_Management_and_Linux_Containers_Guide/sec-Linux_Containers_Compared_to_KVM_Virtualization.html Copyright © 2014 Red Hat, Inc.: Linux Containers Compared to KVM Virtualization The main difference between the KVM virtualization and Linux Containers is that virtual machines require a separate kernel instance to run on, while containers can be deployed from the host operating system. This significantly reduces the complexity of container creation … Read more

Docker: How to live sync host folder with container folder?

You can use volumes in order to do this. You have two options: Docker managed volumes: docker run -v /src/path nodejsapp docker run -i -t -volumes-from <container id> bash The file you edit in the second container will update the first one. Host directory volume: docker run -v `pwd`/host/src/path:/container/src/path nodejsapp The changes you make on … Read more

Running app inside Docker as non-root user

Check this post: http://www.yegor256.com/2014/08/29/docker-non-root.html In rultor.com we run all builds in their own Docker containers. And every time before running the scripts inside the container, we switch to a non-root user. This is how: adduser –disabled-password –gecos ” r adduser r sudo echo ‘%sudo ALL=(ALL) NOPASSWD:ALL’ >> /etc/sudoers su -m r -c /home/r/script.sh r is … Read more

Proper way of handling LXC containers on btrfs

I am on Ubuntu LTS 14 and just ran the following (for first time even) and it worked like a charm: lxc-stop -n ubuntu_base lxc-clone -o ubuntu_base -n ubuntu_base_c1 -s lxc-start -n ubuntu_base_c1 -d # make changes if needed lxc-stop -n ubuntu_base_c1 lxc-snapshot -n ubuntu_base_c1 Using -s with lxc-clone will take a snapshot if backing … Read more

Easy way to transfer files between host and LXC container on LVM

Revised answer: LXC containers share the same kernel as the host, so any filesystem they mount should be accessible from outside. If you do a cat /proc/mounts on the host, can you see the container filesystems? If you see a line like /dev/mapper/… /var/lib/lxc/o1/rootfs ext4 … then you should be able to access /var/lib/lxc/o1/rootfs from … Read more

How to SSH into Docker?

Firstly you need to install a SSH server in the images you wish to ssh-into. You can use a base image for all your container with the ssh server installed. Then you only have to run each container mapping the ssh port (default 22) to one to the host’s ports (Remote Server in your image), … Read more