Questions tagged [lxc]

LXC is an operating system-level virtualization method for running multiple isolated Linux systems (containers) on a single control host. It is sometimes referred to as “chroot on steroids”.

LXC provides operating system-level virtualization not via a full blown virtual machine, but rather provides a virtual environment that has its own process and network space. LXC relies on the Linux kernel cgroups functionality that became available in version 2.6.29 and is now available in all further kernel distibutions.

Cgroups was developed as part of LXC. It also relies on other kinds of namespace-isolation functionality, which were developed and integrated into the mainline Linux kernel.

LXC is similar to other OS-level virtualization technologies on Linux such as OpenVZ and Linux-VServer, as well as those on other operating systems such as FreeBSD jails. LXC Containers can define various cpu limits, memory limits etc. (In short all parameters that can be set via CGROUPS) to prevent any one container from interfering with all other containers running on the same LXC host.

LXC uses the linux bridge-utils commands to create local VLANs, and attach containers and physical interfaces to them. With containers the physical overhead (ram, swap space, one kernel per VM, plus hypervisor) that is present in virtualization methods is reduced. With containers, one kernel and one virtual memory space is shared between all the containers running on that host.

For a comparison of other Operating System virtualization techniques, see this link

557 questions
537
votes
13 answers

How do I assign a port mapping to an existing Docker container?

I'm not sure if I've misunderstood something here, but it seems like it's only possible to set port mappings by creating a new container from an image. Is there a way to assign a port mapping to an existing Docker container?
thasmo
  • 7,142
  • 5
  • 24
  • 30
409
votes
5 answers

What does Docker add to lxc-tools (the userspace LXC tools)?

If you take a look at Docker's features, most of them are already provided by LXC. So what does Docker add? Why would I use Docker over plain LXC?
Flimm
  • 97,949
  • 30
  • 201
  • 217
299
votes
11 answers

How to analyze disk usage of a Docker container

I can see that Docker takes 12GB of my filesystem: 2.7G /var/lib/docker/vfs/dir 2.7G /var/lib/docker/vfs 2.8G /var/lib/docker/devicemapper/mnt 6.3G /var/lib/docker/devicemapper/devicemapper 9.1G /var/lib/docker/devicemapper 12G …
AlonL
  • 5,373
  • 3
  • 29
  • 31
95
votes
6 answers

How to SSH into Docker?

I'd like to create the following infrastructure flow: How can that be achieved using Docker?
Kamil Lelonek
  • 13,631
  • 10
  • 60
  • 87
78
votes
5 answers

Running app inside Docker as non-root user

After yesterday's news of Shocker, it seems like apps inside a Docker container should not be run as root. I tried to update my Dockerfile to create an app user however changing permissions on app files (while still root) doesn't seem to work. I'm…
thom_nic
  • 7,031
  • 6
  • 38
  • 41
55
votes
3 answers

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

I am working on a website powered by Node. So I have made a simple Dockerfile that adds my site's files to the container's FS, installs Node and runs the app when I run the container, exposing the private port 80. But if I want to change a file for…
conradkleinespel
  • 5,357
  • 7
  • 39
  • 74
48
votes
4 answers

How does docker use CPU cores from its host operating system?

My understading, based on the fact that Docker is based on LXC, is that Docker containers share various resources from its host operating system. My concern is with CPU cores. Here is a scenario: a host linux OS has 8 cores I have to deploy a set…
gextra
  • 7,087
  • 7
  • 35
  • 57
47
votes
3 answers

Difference between KVM and LXC

What is the difference between KVM and Linux Containers (LXCs)? To me it seems, that LXC is also a way of creating multiple VMs within the same kernel if we use both "namespaces" and "control groups" features of kernel.
JuliandotNut
  • 1,079
  • 1
  • 10
  • 22
35
votes
4 answers

Docker container exits immediately

I'm using docker v1.2 and having some issues starting a container. The container exits after the "docker run". What's the best way to troubleshoot such issues? Also are there major differences in running containers under AUFS and BTRFS?
Ananth Ravi
  • 647
  • 2
  • 7
  • 13
26
votes
3 answers

Get Docker Container CPU Usage as Percentage

Docker provides an interactive stats command, docker stats [cid] which gives up to date information on the CPU usage, like so: CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O 36e8a65d 0.03% 4.086 MiB/7.798 GiB …
Dan LaManna
  • 3,178
  • 4
  • 20
  • 31
26
votes
1 answer

Resource Usage by stopped Docker containers

Docker makes it easy to stop & restart containers. It also has the ability to pause and then unpause containers. The Docker docs state When the container is exited, the state of the file system and its exit value is preserved. You can start,…
DroidOS
  • 7,220
  • 11
  • 70
  • 142
26
votes
3 answers

Docker daemon memory leak due to logs from long running process

I have the following setup: Perl service running in a container and writing logs out to STDERR logspout to ship those logs out to a remote server for archiving in a 600 MB RAM machine. I also truncate the logs periodically…
alpha_cod
  • 1,703
  • 3
  • 18
  • 40
26
votes
2 answers

Start full container in Docker?

According to this github issue it should be possible to start a full container with Upstart, cron etc. with Docker 0.6 or later but how do I do that? I was expecting that docker run -t -i ubuntu /sbin/init would work just like lxc-start -n ubuntu…
Epeli
  • 16,564
  • 10
  • 63
  • 76
26
votes
5 answers

sudo: effective uid is not 0, is sudo installed setuid root?

I am trying to create deb package from LXC rootfs, and after creating it I want to install that package any computer. Up to this point I achieved packaging and installing deb package, however after installation of LXC package, I cannot be…
Salih Kardan
  • 579
  • 1
  • 5
  • 16
26
votes
4 answers

Launch a container with Docker without specifying command

I'm familiar with LXC and wanted to try out docker. The issue I'm facing is that I can't find a way to just tell docker to start a container in the background, without executing a command. For example, with LXC I would do : lxc create -t ubuntu -n…
rmonjo
  • 2,305
  • 5
  • 24
  • 37
1
2 3
37 38