KVM °¡»óÈ ±â¹Ý Host OS : CentOS 7 X86_64
¼³Ä¡
# yum install docker
# docker info
Containers: 8
Images: 5
Storage Driver: devicemapper
Pool Name: docker-253:1-1048787-pool
Data file: /var/lib/docker/devicemapper/devicemapper/data
Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
Data Space Used: 1334.5 Mb
Data Space Total: 102400.0 Mb
Metadata Space Used: 1.6 Mb
Metadata Space Total: 2048.0 Mb
Execution Driver: native-0.2
Kernel Version: 3.10.0-123.el7.x86_64
Docker ÀúÀå¼Ò³»¿¡ ÀÖ´Â CentOS À̹ÌÁö ¸®½ºÆ® È®ÀÎ
# docker search centos
Docker ±âº» À̹ÌÁö ´Ù¿î·Îµå & È®ÀÎ
# docker pull centos
# docker images centos
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos centos5 d5844d902074 3 days ago 467.1 MB
centos centos6 ac1f1b8dce20 3 days ago 212.7 MB
centos centos7 a5fd0258f31c 3 days ago 224 MB
centos latest a5fd0258f31c 3 days ago 224 MB
# docker run centos:centos5 cat /etc/redhat-release
CentOS release 5.10 (Final)
# docker run centos:centos6 cat /etc/redhat-release
CentOS release 6.5 (Final)
# docker run centos:centos7 cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)
# docker run centos:latest cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)
ÄÁÅ×À̳Ê(Container) ·Î±×ÀÎ
# docker run -i -t centos:centos6 /bin/bash
bash-4.1#
È£½ºÆ®
ÇöÀç ½ÇÇàÁß ÄÁÅ×À̳Ê(Container) È®ÀÎ
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
20b914db342c centos:centos6 /bin/bash 16 seconds ago Up 14 seconds cranky_blackwell4
# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
20b914db342c centos:centos6 /bin/bash 5 minutes ago Up 5 minutes cranky_blackwell4
2b82eafc6f1a centos:centos6 /bin/bash 12 minutes ago Exited (0) 9 minutes ago drunk_feynman0
6e6082685a81 centos:centos7 cat /etc/redhat-rele 59 minutes ago Exited (0) 59 minutes ago dreamy_sinoussi5
f49a44ce15de centos:centos7 cat /etc/redhat-rele 59 minutes ago Exited (0) 59 minutes ago stupefied_bohr5
fec958b140f5 centos:centos6 cat /etc/redhat-rele 59 minutes ago Exited (0) 59 minutes ago romantic_rosalind8
8beeeed1999c centos:centos5 cat /etc/redhat-rele 59 minutes ago Exited (0) 59 minutes ago condescending_hypatia8
# docker ps -help
Usage: docker ps [OPTIONS]
List containers
-a, --all=false Show all containers. Only running containers are shown by default.
--before="" Show only container created before Id or Name, include non-running ones.
-l, --latest=false Show only the latest created container, include non-running ones.
-n=-1 Show n last created containers, include non-running ones.
--no-trunc=false Don't truncate output
-q, --quiet=false Only display numeric IDs
-s, --size=false Display sizes
--since="" Show only containers created since Id or Name, include non-running ones.
# docker run -help
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Run a command in a new container
-a, --attach=[] Attach to stdin, stdout or stderr.
-c, --cpu-shares=0 CPU shares (relative weight)
--cidfile="" Write the container ID to the file
--cpuset="" CPUs in which to allow execution (0-3, 0,1)
-d, --detach=false Detached mode: Run container in the background, print new container id
--dns=[] Set custom dns servers
--dns-search=[] Set custom dns search domains
-e, --env=[] Set environment variables
--entrypoint="" Overwrite the default entrypoint of the image
--env-file=[] Read in a line delimited file of ENV variables
--expose=[] Expose a port from the container without publishing it to your host
-h, --hostname="" Container host name
-i, --interactive=false Keep stdin open even if not attached
--link=[] Add link to another container (name:alias)
--lxc-conf=[] (lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"
-m, --memory="" Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
--name="" Assign a name to the container
--net="bridge" Set the Network mode for the container
'bridge': creates a new network stack for the container on the docker bridge
'none': no networking for this container
'container:<name|id>': reuses another container network stack
'host': use the host network stack inside the contaner
-p, --publish=[] Publish a container's port to the host
format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort
(use 'docker port' to see the actual mapping)
-P, --publish-all=false Publish all exposed ports to the host interfaces
--privileged=false Give extended privileges to this container
--rm=false Automatically remove the container when it exits (incompatible with -d)
--sig-proxy=true Proxify all received signal to the process (even in non-tty mode)
-t, --tty=false Allocate a pseudo-tty
-u, --user="" Username or UID
-v, --volume=[] Bind mount a volume (e.g. from the host: -v /host:/container, from docker: -v /container)
--volumes-from=[] Mount volumes from the specified container(s)
-w, --workdir="" Working directory inside the container
# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.42.1 netmask 255.255.0.0 broadcast 0.0.0.0
inet6 fe80::5484:7aff:fefe:9799 prefixlen 64 scopeid 0x20<link>
ether 56:84:7a:fe:97:99 txqueuelen 0 (Ethernet)
RX packets 26 bytes 1832 (1.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3 bytes 258 (258.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 115.68.200.33 netmask 255.255.255.0 broadcast 115.68.200.255
inet6 fe80::dc11:12ff:fee1:7 prefixlen 64 scopeid 0x20<link>
ether de:11:12:e1:00:07 txqueuelen 1000 (Ethernet)
RX packets 319583 bytes 470142277 (448.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 13911 bytes 1653392 (1.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 2 bytes 198 (198.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2 bytes 198 (198.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0