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

591 questions
733
votes
15 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
  • 9,159
  • 6
  • 27
  • 32
417
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
  • 136,138
  • 45
  • 251
  • 267
115
votes
7 answers

How to SSH into Docker?

I'd like to create the following infrastructure flow: How can that be achieved using Docker?
Kamil Lelonek
  • 14,592
  • 14
  • 66
  • 90
79
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,809
  • 6
  • 42
  • 43
70
votes
4 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
  • 6,560
  • 10
  • 51
  • 87
52
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,169
  • 1
  • 12
  • 22
49
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
  • 8,439
  • 8
  • 40
  • 62
40
votes
5 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
  • 717
  • 2
  • 7
  • 13
36
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,675
  • 5
  • 30
  • 37
30
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,431
  • 4
  • 23
  • 35
30
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
  • 8,530
  • 16
  • 99
  • 171
29
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…
esamatti
  • 18,293
  • 11
  • 75
  • 82
28
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,933
  • 5
  • 25
  • 43
28
votes
1 answer

Should you install nginx inside docker?

I am wondering about the pros and cons of having or not having nginx inside your docker image. There are plenty of tutorials on how to install nginx on docker, but what I am asking is, should you or should you not? Should you install nginx on the…
garbagecollector
  • 3,731
  • 5
  • 32
  • 44
27
votes
4 answers

How do I move a docker container's image to a persistent disk?

We have noticed that our containers are taking up a lot of space, one of the reasons for this is the images. We would like to move the images. I know right now they are stored in /var/lib/docker/graph//layer Is there a way to move these to…
dvaini
  • 283
  • 1
  • 3
  • 5
1
2 3
39 40