lxc

How to analyze disk usage of a Docker container

橙三吉。 提交于 2019-11-28 13:12:51
问题 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 /var/lib/docker But, how do I know how this is distributed over the containers? I tried to attach to the containers by running (the new v1.3 command) docker exec -it <container_name> bash and then running 'df -h' to analyze the disk usage. It seems to be working, but

太全了|万字详解Docker架构原理、功能及使用

余生长醉 提交于 2019-11-27 21:37:46
一、简介 1、了解Docker的前生LXC LXC为Linux Container的简写。可以提供轻量级的虚拟化,以便隔离进程和资源,而且不需要提供指令解释机制以及全虚拟化的其他复杂性。相当于C++中的NameSpace。容器有效地将由单个操作系统管理的资源划分到孤立的组中,以更好地在孤立的组之间平衡有冲突的资源使用需求。 与传统虚拟化技术相比,它的优势在于: (1)与宿主机使用同一个内核,性能损耗小; (2)不需要指令级模拟; (3)不需要即时(Just-in-time)编译; (4)容器可以在CPU核心的本地运行指令,不需要任何专门的解释机制; (5)避免了准虚拟化和系统调用替换中的复杂性; (6)轻量级隔离,在隔离的同时还提供共享机制,以实现容器与宿主机的资源共享。 总结:Linux Container是一种轻量级的虚拟化的手段。 Linux Container提供了在单一可控主机节点上支持多个相互隔离的server container同时执行的机制。Linux Container有点像chroot,提供了一个拥有自己进程和网络空间的虚拟环境,但又有别于虚拟机,因为lxc是一种操作系统层次上的资源的虚拟化。 2、LXC与docker什么关系? docker并不是LXC替代品,docker底层使用了LXC来实现,LXC将linux进程沙盒化,使得进程之间相互隔离

Setting absolute limits on CPU for Docker containers

筅森魡賤 提交于 2019-11-27 15:36:28
问题 I'm trying to set absolute limits on Docker container CPU usage. The CPU shares concept ( docker run -c <shares> ) is relative, but I would like to say something like "let this container use at most 20ms of CPU time every 100ms. The closest answer I can find is a hint from the mailing list on using cpu.cfs_quota_us and cpu.cfs_period_us . How does one use these settings when using docker run ? I don't have a strict requirement for either LXC-backed Docker (e.g. pre0.9) or later versions, just

Container的新机遇:Docker

为君一笑 提交于 2019-11-27 14:03:07
从技术上看,Container并非近几年的创新,OpenVZ、FreeBSD jails、Solaris Zones等都是Container技术(轻量级虚拟化技术,OS层虚拟化技术)的 实现 ,而Fedora和Mozilla中国的区代表 Gerard Braad 在接受CSDN采访时进一步扩展了Container的概念: 浏览器的沙箱从资源隔离的角度,以及Java的J2EE Container从标准抽象化的角度,其实跟Container的概念是一致的。 当下,PaaS越来越多的和Container联系在一起,Container的高资源利用率等特性恰恰是PaaS需要的。 Container的优势 总结为以下四点: 提高计算密度 一个虚机占用的资源比一个Container占用的资源不止多十倍。在一个物理机上开一百个虚机是很困难的,但要实现100多个,甚至几百个 Container是很正常的。腾讯在大量使用Container。某大型互联网公司上次升级发行版,主要就是为了使用Cgroups,方便限定资源,以 充分利用CPU。要知道有能力维护自己版本内核的公司,做出这样的决定是非常不容易的,可见其好处是巨大的。 大互联网公司非常适合Container,Facebook一台虚机都没有,因为这些互联网公司要求充分利用计算资源。虚机起码还要再跑一个Guest系统,太耗资源。 同时

Running app inside Docker as non-root user

南楼画角 提交于 2019-11-27 09:23:26
问题 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 guessing this is because some LXC permission is not being granted to the root user maybe? Here's my Dockerfile: # Node.js app Docker file FROM dockerfile/nodejs MAINTAINER Thom Nichols "thom@thomnichols.org" RUN useradd -ms /bin/bash node ADD .

How to SSH into Docker?

為{幸葍}努か 提交于 2019-11-27 09:10:37
问题 I'd like to create the following infrastructure flow: How can that be achieved using Docker? 回答1: 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), using -p <hostPort>:<containerPort> . i.e: docker run -p 52022:22 container1 docker run -p 53022:22 container2

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

本小妞迷上赌 提交于 2019-11-27 08:54:57
问题 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? 回答1: From the Docker FAQ: Docker is not a replacement for lxc. "lxc" refers to capabilities of the linux kernel (specifically namespaces and control groups) which allow sandboxing processes from one another, and controlling their resource allocations. On top of this low-level foundation of kernel features, Docker offers a high-level tool with

嵌入式Linux容器技术

别来无恙 提交于 2019-11-27 05:09:58
嵌入式Linux容器技术 一、Linux容器技术 Linux Container容器是一种内核虚拟化技术,可以提供轻量级的虚拟化,以便隔离进程和资源。 LXC为Linux Container的简写。可以提供轻量级的虚拟化,以便隔离进程和资源,而且不需要提供指令解释机制以及全虚拟化的其他复杂性。相当于C++中的NameSpace。容器有效地将由单个操作系统管理的资源划分到孤立的组中,以更好地在孤立的组之间平衡有冲突的资源使用需求。与传统虚拟化技术相比,它的优势在于: (1)与宿主机使用同一个内核,性能损耗小; (2)不需要指令级模拟; (3)不需要即时(Just-in-time)编译; (4)容器可以在CPU核心的本地运行指令,不需要任何专门的解释机制; (5)避免了准虚拟化和系统调用替换中的复杂性; (6)轻量级隔离,在隔离的同时还提供共享机制,以实现容器与宿主机的资源共享。 总结:Linux Container是一种轻量级的虚拟化的手段。 Linux Container提供了在单一可控主机节点上支持多个相互隔离的server container同时执行的机制。Linux Container有点像chroot,提供了一个拥有自己进程和网络空间的虚拟环境,但又有别于虚拟机,因为lxc是一种操作系统层次上的资源的虚拟化。 LXC与docker的关系 (1

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

被刻印的时光 ゝ 提交于 2019-11-27 02:28:14
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? Fujimoto Youichi I'm also interested in this problem. As @Thasmo mentioned, port forwardings can be specified ONLY with docker run command. Other commands, docker start does not have -p option and docker port only displays current forwardings. To add port forwardings, I always follow these steps, stop running container docker stop test01 commit the container docker commit

docker(2):docker的“前身”—lxc

谁说我不能喝 提交于 2019-11-26 16:02:31
docker-kubernetes集合 docker docker(1):容器技术简介 docker(2):docker的“前身”—lxc docker(3):docker简介 docker(4):docker的安装(centos7)和加速 docker(5):docker的镜像操作 docker(6):docker的容器管理 docker(7):docker容器的网络访问 docker(8):docker容器的端口映射 docker(9):docker的数据卷和数据卷容器 docker(10):手工制作docker镜像 . kubernetes . 来源: https://www.cnblogs.com/wangxu01/p/11303386.html