lxc

How to analyze disk usage of a Docker container

对着背影说爱祢 提交于 2019-11-29 19:02:06
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 not with containers that use 'volumes-from'. For example, I use a data-only container for MongoDB,

docker简单介绍

為{幸葍}努か 提交于 2019-11-29 10:12:55
1.直接在终端输入docker会返回docker支持的所有命令和一些通用的参数,如下 Usage: docker [OPTIONS] COMMAND [arg...] docker [ --help | -v | --version ] A self-sufficient runtime for containers. Options: --config=~/.docker Location of client config files -D, --debug Enable debug mode -H, --host=[] Daemon socket(s) to connect to -h, --help Print usage -l, --log-level=info Set the logging level --tls Use TLS; implied by --tlsverify --tlscacert=~/.docker/ca.pem Trust certs signed only by this CA --tlscert=~/.docker/cert.pem Path to TLS certificate file --tlskey=~/.docker/key.pem Path to TLS key file --tlsverify Use TLS and verify

2019/07/29 Linux容器和lxc(01)

不羁的心 提交于 2019-11-29 04:57:28
容器是一种基础工具;泛指任何可以用于容纳其它物品的工具,可以部分或完全封闭,被用于容纳、储存、运输物品;物体 可以被放置在容器中,而容器则可以保护内容物; 人类使用容器的历史至少有十万年,甚至可能有数百万年的历史; v 容器的类型 ɝ 瓶 - 指口部比腹部窄小、颈长的容器。 ɝ 罐 - 指那些开口较大、一般为近圆筒形的器皿。 ɝ 箱 - 通常是立方体或圆柱体。形状固定。 ɝ 篮 - 以条状物编织而成。 ɝ 桶 - 一种圆柱形的容器。 ɝ 袋 - 柔性材料制成的容器,形状会受内容物而变化。 ɝ 瓮 - 通常是指陶制,口小肚大的容器。 ɝ 碗 - 用来盛载食物的容器。 ɝ 柜 - 指一个由盒组成的家俱。 ɝ 鞘 - 用于装载刀刃的容器。 要把信息系统称为容器,也需要容纳物品,物品是虚拟的,是我们的进程文件等等,放置在统一的封闭组件内部,这个组件称为容器 比较成熟的LXC 此前的主机虚拟化技术,每一个运行出来的实例,提供的是从底层的基础硬件开始,一直到高层的基础环境,让每一个对应的虚拟机实例自己拥有可视的而且隔离其他实例的基础硬件CPU,内存等等, 硬件划分后,提供给每个实例,从而让每个实例有了自己的操作系统内核空间和用户空间,作为对应的实例使用者,像使用正常操作系统一样。 隔离性非常好,因为每个主机都有内核,每一个虚拟机的进程是看不到底层Hypervisor

Docker container refuses to get killed after run command turns into a zombie

痞子三分冷 提交于 2019-11-29 02:37:52
问题 first thing first. my system info and versions: $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 13.04 Release: 13.04 Codename: raring $ sudo docker version Client version: 0.9.0 Go version (client): go1.2.1 Git commit (client): 2b3fdf2 Server version: 0.9.0 Git commit (server): 2b3fdf2 Go version (server): go1.2.1 $ lxc-version lxc version: 0.9.0 $ uname -a Linux ip-10-0-2-86 3.8.0-19-generic #29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 x86_64 x86_64

Get Docker Container CPU Usage as Percentage

左心房为你撑大大i 提交于 2019-11-28 23:04:22
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 0.05% 281.3 MiB/288.3 MiB I'm trying to get the CPU usage as a percentage in a digestible format to do some analysis. I've seen the stats in /sys/fs which seem to provide similar values as the Docker Remote API which gives me this JSON blob: { "cpu_usage": { "usage_in_usermode": 345230000000, "total_usage": 430576697133, "percpu_usage": [ 112999686856, 106377031910, 113291361597,

Linux下安装docker

耗尽温柔 提交于 2019-11-28 22:50:09
https://www.cnblogs.com/xred/p/3845215.html 名词解释 名词 解释 备注 Selinux 安全增强型 Linux(Security-Enhanced Linux)简称 SELinux。它是一个 Linux 内核模块,也是 Linux 的一个安全子系统。 LXC LXC为Linux Container的简写;Linux Container容器是一种内核虚拟化技术,可以提供轻量级的虚拟化,以便隔离进程和资源。LXC 与 docker 的关系 :( 1 ) Docker 并不是 LXC 的替代品, Docker 的底层就是使用了 LXC 来实现的。 LXC 将 Linux 进程沙盒化,使得进程之间相互隔离,并且能够控制各进程的资源分配。 ( 2 )在 LXC 的基础之上, Docker 提供了一系列更强的功能 EPEL EPEL的全称叫 Extra Packages for Enterprise Linux 。EPEL是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。装上了 EPEL之后,就相当于添加了一个第三方源。 hop5.repo Centos 6.x Package Repository http://www.hop5.in/yum/el6

Start full container in Docker?

本小妞迷上赌 提交于 2019-11-28 19:54:11
问题 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 /sbin/init and I would get a login screen, but instead it displays nothing. I also tried to access it using ssh, but no luck. I'm using the default ubuntu image from Docker index. 回答1: docker run ubuntu /sbin/init appears to work flawlessly for me

Running app inside Docker as non-root user

我的未来我决定 提交于 2019-11-28 15:42:00
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 . /data # This next line doesn't seem to have any effect: RUN chown -R node /data ENV HOME /home/node USER

How to SSH into Docker?

安稳与你 提交于 2019-11-28 15:24:56
I'd like to create the following infrastructure flow: How can that be achieved using 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), using -p <hostPort>:<containerPort> . i.e: docker run -p 52022:22 container1 docker run -p 53022:22 container2 Then, if ports 52022 and 53022 of host's are accessible from outside, you can directly ssh to the

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

≯℡__Kan透↙ 提交于 2019-11-28 14:53:50
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? Solomon Hykes 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 several powerful functionalities: Portable deployment across machines. Docker defines a format for