首页 文章 精选 留言 我的

精选列表

搜索[Emacs化],共10000篇文章
优秀的个人博客,低调大师

Docker自动化双主MySQL-01:安装docker并使用docker 获取镜像

nstall with yum1.shell>sudo yum update2.添加dockeryum$ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'[dockerrepo]name=Docker Repositorybaseurl=https://yum.dockerproject.org/repo/main/centos/7/enabled=1gpgcheck=1gpgkey=https://yum.dockerproject.org/gpgEOF 3.安装docker的包shell>sudo yum install docker-engine4.将docker加到服务里面$ sudo systemctl enable docker.service5.启动docker$ sudo systemctl start docker6.在容器中运行镜像看docker是否安装成功 $ sudo docker run --rm hello-world 二、使用docker 获取镜像:1.查看docker是否运行:[root@localhost ~]# ps aux | grep dockerroot 8229 1.6 0.6 944968 49924 ? Ssl 10:54 0:13 /usr/bin/dockerdroot 8235 0.0 0.1 367832 12216 ? Ssl 10:54 0:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --runtime docker-runcroot 8827 0.0 0.0 112652 960 pts/1 S+ 11:07 0:00 grep --color=auto docker2.使用docker获取镜像: 可以使用 docker pull 命令来从仓库获取所需要的镜像 [root@localhost ~]#docker pull centos[root@localhost ~]# docker images 有哪些镜像REPOSITORY TAG IMAGE ID CREATED SIZEcentos latest 0584b3d2cf6d 6 weeks ago 196.5 MBhello-world latest c54a2cc56cbb 5 months ago 1.848 kB3.查看后台运行docker镜像[root@localhost ~]# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESe793eb3f32c2 centos "/bin/bash" 3 minutes ago Up 3 minutes alisql4.进入docker里面[root@localhost ~]# docker exec -it e793eb3f32c2 /bin/bash[root@e793eb3f32c2 /]# 查看容器:[root@localhost opt]# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESe793eb3f32c2 centos "/bin/bash" 6 hours ago Up 6 hours alisql将容器提交为镜像[root@localhost opt]# docker commit -m "install alisql" -a "wjj" e793eb3f32c2 alisql/m:5.6.32sha256:3dff1697293ac450627ce4d6283c215315dcef3256d00206be5cabb831314780 其中, -m 来指定提交的说明信息,跟我们使用的版本控制工具一样; -a 可以指定更新的用户信息;之后是用来创建镜像的容器的 ID;最后指定目标镜像的仓库名和 tag 信息。创建成功后会返回这个镜像的 ID 信息。使用 docker images 来查看新创建的镜像。 [root@localhost opt]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEalisql/m 5.6.32 3dff1697293a About a minute ago 2.181 GB 之后,可以使用新的镜像来启动容器 导出镜像:[root@localhost opt]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEalisql_m 5.6.32 e1b266255ad5 2 minutes ago 2.181 GB 3dff1697293a 8 minutes ago 2.181 GB 53c6ea2f5444 30 minutes ago 5.117 GBcentos latest 0584b3d2cf6d 6 weeks ago 196.5 MBhello-world latest c54a2cc56cbb 5 months ago 1.848 kB [root@localhost docker_images]# docker save -o alisql_m.tar alisql/m:5.6.32[root@localhost docker_images]# docker save -o alisql_s.tar alisql/s:5.6.32 save opt/alisql_m.tar的意思是把image 保存在opt目录里并命令为alisql_m.tar 使用新的镜像来启动容器:[root@localhost docker_images]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEalisql/s 5.6.32 f502d6c3c562 3 minutes ago 2.456 GBalisql/m 5.6.32 ee0aea15ad83 4 minutes ago 2.497 GB docker run 就是运行容器的命令,具体格式我们会在后面的章节讲解,我们这里简要的说明一下上面用到的参数-ti:这是两个参数,一个是 -i:交互式操作,一个是 -t 终端。我们这里打算进入 bash 执行一些命令并查看返回结果,因此我们需要交互式终端。使用新的镜像来启动容器:[root@localhost ~]# docker run -t -i alisql_s:5.6.32 /bin/bash 827 docker ps -a 828 docker rm -f 79cab3e7e30a 829 docker rmi bc9edf41d6b2docker exec -it 容器名 执行脚本或者获取脚本位置 docker build -t ma . [root@localhost docker_mysql_5.6]# docker ps -aq0de7852c69928e3134e3ed0c4cbd4c39e33267f51a8e755b56d33b2836ea88dd6a8cf960d38476a689b658bfe5f40850d5c9fbe08387[root@localhost docker_mysql_5.6]# docker ps -aq | xargs docker rm -f0de7852c69928e3134e3ed0c4cbd4c39e33267f51a8e755b56d33b2836ea88dd6a8cf960d38476a689b658bfe5f40850d5c9fbe08387

优秀的个人博客,低调大师

关于项目自动化测试架构的改良计划 - XML格式转为json格式

因为讨论下来,最终的DataProvider格式需要是一个json格式,所以我们还必须提供方法吧xml格式转为json格式,现在很多框架比如json-lib框架能很轻易的完成这个任务了。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 /** * This class will read the xml file and then change it to a json object *@author cwang58 *@created date: Jun 9, 2013 */ public class XMLJSONConverter { /** * This method will convert the xml to json object * @param xml the xml string * @return the json string */ public static String xml2JSON(String xml){ XMLSerializer xmlSerializer = new XMLSerializer(); JSON json = xmlSerializer.read(xml); return json.toString(); } .. } 就几行代码,很容易读懂。 本文转自 charles_wang888 51CTO博客,原文链接:http://blog.51cto.com/supercharles888/1221759,如需转载请自行联系原作者

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册
修改密码
忘记密码