1. 程式人生 > >docker部署安裝

docker部署安裝

architect null 虛擬 nta run profile sco 部署安裝 image

docker采用Linux內核技術,所以只能運行在Linux上,所謂的windows平臺是使用boot2Docker工具,boot2Docker是在VisualBox構建一個linux精簡化環境。

Boot2Docker官方下載地址:https://github.com/boot2docker/windows-installer/releases
Boot2Docker官方安裝手冊:http://docs.docker.com/installation/windows/

1.docker安裝

系統環境centos7.3

使用默認yum源或阿裏等yum源默認安裝的版本太久,這裏使用docker官方yum源進行安裝

http://yum.dockerproject.org/

cat >/etc/yum.repos.d/docker.repo <<-EOF
[docker]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
yum makecache
yum install docker-engine


使用docker info可以查看docker一些信息

[root@redis ~]# docker info
Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 1
Server Version: 17.05.0-ce
Storage Driver: devicemapper
 Pool Name: docker-8:3-859080-pool
 Pool Blocksize: 65.54kB
 Base Device Size: 10.74GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 153.5MB
 Data Space Total: 107.4GB
 Data Space Available: 7.572GB
 Metadata Space Used: 761.9kB
 Metadata Space Total: 2.147GB
 Metadata Space Available: 2.147GB
 Thin Pool Minimum Free Space: 10.74GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.140-RHEL7 (2017-05-03)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
 selinux
Kernel Version: 3.10.0-693.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 976.3MiB
Name: redis
ID: JCXM:GSG2:T4GN:OLEL:ZGNC:ISJI:GU22:VOKB:7TDQ:OLVT:GWLQ:6LSK
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Registry Mirrors:
 https://abvzwt2w.mirror.aliyuncs.com/
Live Restore Enabled: false
[root@redis ~]# docker version
Client:
 Version:      17.05.0-ce #<==客戶端版本
 API version:  1.29
 Go version:   go1.7.5
 Git commit:   89658be
 Built:        Thu May  4 22:06:25 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.05.0-ce #<==服務端版本
 API version:  1.29 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   89658be
 Built:        Thu May  4 22:06:25 2017
 OS/Arch:      linux/amd64
 Experimental: false

docker啟動後會在宿主機創建一個docker0虛擬網卡,docker中所有監聽都會在docker0網段進行分配


[root@redis ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:b3:50:32 brd ff:ff:ff:ff:ff:ff
    inet 172.0.0.2/24 brd 172.0.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:feb3:5032/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:b3:50:3c brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.12/24 brd 10.0.0.255 scope global eth1
       valid_lft forever preferred_lft forever
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN 
    link/ether 02:42:c1:39:7e:58 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:c1ff:fe39:7e58/64 scope link 
       valid_lft forever preferred_lft forever

2.配置文件

大蘇打

大搜

大蘇打

docker部署安裝