docker部署安装

Posted 钢闸门的笔记收藏册

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker部署安装相关的知识,希望对你有一定的参考价值。

    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一些信息

[[email protected] ~]# 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
[[email protected] ~]# 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网段进行分配


[[email protected] ~]# 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部署安装的主要内容,如果未能解决你的问题,请参考以下文章

12-Docker-部署SonarQube

Python3 - Docker 安装部署Gitlab代码托管教程

Python3 - Docker 安装部署Gitlab代码托管教程

Python3 - Docker 安装部署Gitlab代码托管教程

Python3 - Docker 安装部署Gitlab代码托管教程

docker安装步骤及基于docker容器部署web应用LNMP服务器环境