-
Notifications
You must be signed in to change notification settings - Fork 114
/
Copy pathdocker_under_the_hood
64 lines (39 loc) · 1.51 KB
/
docker_under_the_hood
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# To check the memory limit enforced via cgroup
# cat /sys/fs/cgroup/memory/memory.limit_in_bytes
536870912
OR
# docker container stats <container id>
# --pid let the container see the host process table(!!! carefull)
# Normal container run
$ docker container run -it centos bash
[root@83a91f678bd2 /]# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 14:45 pts/0 00:00:00 bash
root 14 1 0 14:46 pts/0 00:00:00 ps -ef
# Put the command in the background
$ vim /tmp/testfile&
# Let you see the host process table
docker container run -it --pid=host centos bash
# -v let you mount, the file on host to the mount point inside the container
$ docker container run -it -v /:/host --privileged centos bash
# --net=host open all network interface on the host to the container
docker container run -it --net=host centos bash
# --privileges open root and selinux priviledge on the container
# Check the logging driver
$ docker info |grep -i log
Logging Driver: json-file
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
# To change the logging driver
$ docker container run --log-driver none -dt centos ping google.com
# docker logs file is not available for drivers other then json-file and journald
# To check if debug mode is enabled in docker
$ docker info |grep -i debug
Debug Mode: false
Debug Mode: false
# To enable debug mode
cat /etc/docker/daemon.json
{
"debug": true
}
# To verify it
journalctl -u docker.service | tail