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.repo yum 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/config setenforce 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 centos NAME DESCRIPTION STARS OFFICIAL AUTOMATED centos 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]
(3)下载镜像
注意镜像名称要写全,就是用docker search name 搜出来的NAME列的名称。
docker pull name 如示例:
[root@dockermain-154 src]# docker pull jdeathe/centos-ssh-apache-php Pulling repository jdeathe/centos-ssh-apache-php ........ 62203f428b1f: Download complete e1812755a4ca: Download complete 0910edda3736: Download complete Status: Downloaded newer image for jdeathe/centos-ssh-apache-php:latest
(4)查看已安装的镜像
[root@dockermain-154 src]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE centos latest dade6cb4530a 10 days ago 210.1 MB jdeathe/centos-ssh-apache-php latest f1a489312a4a 3 months ago 297.7 MB
(5)docker容器中运行命令
docker run命令有两个参数,一个是镜像名,一个是要在镜像中运行的命令。 注意:IMAGE=REPOSITORY[:TAG],如果IMAGE参数不指定镜像的TAG,默认TAG为latest。
[root@dockermain-154 run]# sudo docker run jdeathe/centos-ssh-apache-php echo 'hello world!' hello world! [root@dockermain-154 run]# sudo docker run jdeathe/centos-ssh-apache-php hostname db7e1d2269fb
(6)列出容器
查看最近生成的容器:docker ps -l
查看正在运行的容器:docker ps
[root@dockermain-154 run]# docker ps -l CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES db7e1d2269fb jdeathe/centos-ssh-apache-php:latest "hostname" 27 seconds ago Exited (0) 26 seconds ago adoring_babbage
(7)显示容器标准输出
[root@dockermain-154 run]# docker ps -l CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES db7e1d2269fb jdeathe/centos-ssh-apache-php:latest "hostname" 27 seconds ago Exited (0) 26 seconds ago adoring_babbage [root@dockermain-154 run]# docker logs db7e1d2269fb db7e1d2269fb
(8)给容器中安装程序或服务
[root@dockermain-154 run]# sudo docker run centos yum install -y httpd Loaded plugins: fastestmirror ..........
Dependency Installed:
apr.x86_64 0:1.4.8-3.el7 apr-util.x86_64 0:1.5.2-6.el7 centos-logos.noarch 0:70.0.6-1.el7.centos httpd-tools.x86_64 0:2.4.6-19.el7.centos mailcap.noarch 0:2.1.41-2.el7
Failed:
httpd.x86_64 0:2.4.6-19.el7.centos
Complete!
(9)保存对容器中的修改并生成新的镜像
docker commit CONTAINERID [REPOSITORY[:TAG]]
REPOSITORY参数可以是新的镜像名字,也可以是旧的镜像名;如果和旧的镜像名和TAG都相同,会覆盖掉旧的镜像。
[root@dockermain-154 ~]# docker commit bd7cc4f4ac92 centos:httpd 1e0915f3247b86414ebc11fd994fc6abfb590ff3b1ab890949c845ee88b2d9f4 [root@dockermain-154 ~]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE centos httpd 1e0915f3247b 9 seconds ago 320.8 MB centos latest dade6cb4530a 10 days ago 210.1 MB jdeathe/centos-ssh-apache-php latest f1a489312a4a 3 months ago 297.7 MB
(10)停止正在运行的容器
(11)查看容器或镜像详情
下面是我刚保存提交产生的新的容器
[root@dockermain-154 ~]# docker inspect 943e45b6e5f3 [{ "AppArmorProfile": "", "Args": [], "Config": { "AttachStderr": true, "AttachStdin": true, "AttachStdout": true, "Cmd": [ "/bin/bash" ], "CpuShares": 0, "Cpuset": "", "Domainname": "", "Entrypoint": null, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "ExposedPorts": null, "Hostname": "943e45b6e5f3", "Image": "centos:httpd", "MacAddress": "", "Memory": 0, "MemorySwap": 0, "NetworkDisabled": false, "OnBuild": null, "OpenStdin": true, "PortSpecs": null, "StdinOnce": true, "Tty": true, "User": "", "Volumes": null, "WorkingDir": "" },
(12)删除容器
docker rm CONTAINERID
查看所有容器ID:docker ps -a -q
删除所有的容器:docker rm $(docker ps -a -q)
(13)删除镜像
docker rmi IMAGE
(14)查看docker的信息,包括Containers和Images数目、kernel版本等
[root@dockermain-154 ~]# docker info Containers: 14 Images: 56 Storage Driver: aufs Root Dir: /var/lib/docker/aufs Dirs: 89 Execution Driver: native-0.2 Kernel Version: 3.10.5-3.el6.x86_64 Operating System: <unknown> CPUs: 1 Total Memory: 989.6 MiB Name: dockermain-154 ID: W4PW:W3XR:FQZE:SBAA:2DS2:BM6N:DV5B:ARF2:3SZM:XGST:5ZF7:DFZV WARNING: No swap limit support
(15)创建容器,并像平常ssh登录一样使用
[root@dockermain-154 ~]# docker run -i -t centos /bin/bash [root@7c0414d03fe7 /]# ls bin dev etc home lib lib64 lost+found media mnt opt proc root run sbin selinux srv sys tmp usr var
以上所述是小编给大家介绍的部署维护docker环境的详细教程,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。
更新日志
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]