Docker 安装
环境:Centos 7或6内核版本:3.10.0-514.26.2.el7.x86_64
centos6开始安装
1
2
3
4
5
# yum install http://dl.fedorap
# roject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# yum install docker-io
# service docker start
# chkconfig docker on
1
2
3
4
5
6
7
8
9
10
11
# docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d/1.7.1
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d/1.7.1
OS/Arch (server): linux/amd64
centos7开始安装:
1
2
3
# yum install docker
# service docker start
# chkconfig docker on
测试
1
2
3
4
5
6
# docker pull hello-world
latest: Pulling from hello-world
fc882b159a63: Pull complete
f054dc87ed76: Pull complete
Digest: sha256:9a4ec8dac439d00fff31bf41b23902bfd7f7465d4b4c8c950e572e7392f33c66
Status: Downloaded newer image for hello-world:latest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
此时可以查看到主机多了一块虚拟网卡配置
1
2
3
4
5
6
7
8
# ifconfig docker0
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>mtu 1500
inet 172.17.0.1netmask 255.255.0.0broadcast 0.0.0.0
ether 02:42:19:45:8c:19txqueuelen 0(Ethernet)
RX packets 53124bytes 37295271 (35.5 MiB)
RX errors 0dropped 0overruns 0frame 0
TX packets 54946bytes 158059143 (150.7 MiB)
TX errors 0dropped 0 overruns 0carrier 0collisions 0
页:
[1]