首页 > 网站 > 建站经验 > 正文

部署维护docker环境的详细教程

2019-11-02 17:02:35
字体:
来源:转载
供稿:网友

1,安装环境说明

系统环境:centos6.6

服务应用了:  haproxy  confd   etcd   docker

主机名               ip      服务角色

dockerha-152      192.168.36.152    haproxy confd

dockerEtcd-153     192.168.36.153      etcd

dockermain-154    192.168.36.154    docker

2,安装依懒包,关闭冲突的服务

官方文档要求Linux kernel至少3.8以上,且docker只能运行在64位的系统中。由于RHEL6和CentOS6的内核版本为2.6,因此必须要先升级内核。

cd /etc/yum.repos.d wget http://www.hop5.in/yum/el6/hop5.repoyum install kernel-ml-aufs kernel-ml-aufs-devel -y

修改grub的主配置文件/etc/grub.conf,设置default=0,表示第一个title下的内容为默认启动的kernel(一般新安装的内核在第一个位置)。

然后重启,重启系统,这时候你的内核就成功升级了,版本应该在3.8以上了,

uname -r [root@dockermain-154 shell]# uname -r

3.10.5-3.el6.x86_64

sed -i '/^SELINUX=/c/SELINUX=disabled' /etc/selinux/configsetenforce 0

在Fedora EPEL源中已经提供了docker-io包,下载安装epel:

rpm -ivh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm sed -i 's/^mirrorlist=https/mirrorlist=http/' /etc/yum.repos.d/epel.repo

3,安装组件

(1)haproxy confd

dockerha-152上操作

1、haproxy 

# yum y install haproxy 

2、confd 

# wget https://github.com/kelseyhightower/confd/releases/download/v0.6.3/confd-0.6.3-linux-amd64 # mv confd /usr/local/bin/confd # chmod +x /usr/local/bin/confd # /usr/local/bin/confd -version 

(2)etcd

dockerEtcd-153上操作

# mkdir -p /home/install && cd /home/install # wget https://github.com/coreos/etcd/releases/download/v0.4.6/etcd-v0.4.6-linux-amd64.tar.gz # tar -zxvf etcd-v0.4.6-linux-amd64.tar.gz # cd etcd-v0.4.6-linux-amd64 # cp etcd* /bin/ # /bin/etcd -version etcd version 0.4.6 

(3)Docker

# yum -y install docker-io # service docker start # chkconfig docker on 

4,docker命令使用

(1)查看帮助

docker COMMAND --help

(2)搜索可用的境像

docker search name 如示例:

[root@dockermain-154 src]# docker search centosNAME        DESCRIPTION          STARS  OFFICIAL AUTOMATEDcentos        The official build of CentOS.     817  [OK]  ansible/centos7-ansible    Ansible on Centos7        30     [OK]tutum/centos      Centos image with SSH access. For the root... 13     [OK]jdeathe/centos-ssh-apache-php  CentOS-6 6.5 x86_64 / Apache / PHP / PHP m... 8     [OK]blalor/centos      Bare-bones base CentOS 6.5 image    8     [OK]jprjr/centos-php-fpm                6     [OK]steeef/graphite-centos    CentOS 6.x with Graphite and Carbon via ng... 6     [OK]tutum/centos-6.4     DEPRECATED. Use tutum/centos:6.4 instead. ... 5     [OK]layerworx/centos     A general CentOS 6 image with the EPEL6 an... 2     [OK]jr42/chef-solo-centos    Official CentOS base images with current c... 1     [OK]million12/centos-supervisor   Base CentOS-7 with supervisord launcher, h... 1     [OK]internavenue/centos-percona   Centos-based Percona image.      1     [OK]jdeathe/centos-ssh     CentOS-6 6.5 x86_64 / EPEL Repo. / OpenSSH... 1     [OK]jdeathe/centos-ssh-mysql   CentOS-6 6.5 x86_64 / MySQL. Image include... 1     [OK]yajo/centos-epel     CentOS with EPEL and fully updated    1     [OK]nimmis/java-centos     This is docker images of CentOS 7 with dif... 0     [OK]lighthopper/orientdb-centos   A Dockerfile for creating an OrientDB imag... 0     [OK]bbrietzke/centos-starter   CentOS 7 with EPEL and SupervisorD    0     [OK]tcnksm/centos-node     Dockerfile for CentOS packaging node   0     [OK]insaneworks/centos     CentOS 6.5 x86_64 + @update      0     [OK]snowyday/centos      Provide for emacs and Ricty font on X11 en... 0     [OK]dmglab/centos      CentOS with superpowers!      0     [OK]akroh/centos      Centos 6 container that has been updated w... 0     [OK]timhughes/centos     Centos with systemd installed and running  0     [OK]solict/provisionous-puppet-centos CentOS provisions with Puppet included   0     [OK]
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表