如何通过puppet管理远程docker容器

小编给大家分享一下如何通过puppet管理远程docker容器,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

成都创新互联主营义乌网站建设的网络公司,主营网站建设方案,重庆App定制开发,义乌h5微信小程序开发搭建,义乌网站营销推广欢迎义乌等地区企业咨询

使用脚本访问docker容器:

root@docker:~# ./control.sh 
What you want to do?try input 'help' to get some tips(please input the words in ''): access
Please input the specific container's name:web1
root@050ebb07cf25:/#                   #已经进入docker容器,输入exit退出,不过脚本也会退出

获取帮助信息(不妨多试试其他命令):

root@docker:~# ./control.sh 
What you want to do?try input 'help' to get some tips(please input the words in ''): help
################################################################################################################################
                                            The helping information about this script                                           
################################################################################################################################
COMMAND                                       INFO                                                                              
################################################################################################################################
'status'                                      get the info about the running containers.                                        
'access'                                      access the specific contianer.                                                    
'manage'                                      manage the contianer,such as 'start','stop' and 'delete'.                         
'exit'                                        exit this script.                                                                 
'statusa'                                     show the infomation about all containers.                                         
'statusl'                                     show the latest infomation about container.                                       
################################################################################################################################
MAINCOMMAND                  SUBCOMMAND                  INFO                                                                   
################################################################################################################################
'manage'                     'start'                     launch a exist contianer                                               
'manage'                     'stop'                      stop a running container                                               
'manage'                     'delete'                    detele a not-running container                                         
'manage'                     'status'                    get the info about the running containers                              
'manage'                     'statusa'                   show the infomation about all containers.                              
'manage'                     'statusl'                   show the latest infomation about container.                            
################################################################################################################################
What you want to do?try input 'help' to get some tips(please input the words in ''):

stop容器,delete容器,start容器:

stop容器web1:

root@docker:~# ./control.sh 
What you want to do?try input 'help' to get some tips(please input the words in ''): manage
Please input the container name which you want to manage,or 'exit',or 'help'?: status
Running container:
CONTAINER ID        IMAGE                    COMMAND             CREATED             STATUS              PORTS                    NAMES
050ebb07cf25        training/webapp:latest   "python app.py"     12 minutes ago      Up 12 minutes       0.0.0.0:2000->5000/tcp   web1                   
0ef5d56e4c89        training/webapp:latest   "python app.py"     12 minutes ago      Up 12 minutes       0.0.0.0:1000->5000/tcp   web1/webbase,webbase   
Please input the container name which you want to manage,or 'exit',or 'help'?: web1
Do you want to 'start' or 'stop' or 'delete' your container?: stop
Notice:container is stopping
web1
Please input the container name which you want to manage,or 'exit',or 'help'?:

web1被停掉

start容器web1:

Please input the container name which you want to manage,or 'exit',or 'help'?: web1
Do you want to 'start' or 'stop' or 'delete' your container?: start
Notice:Please make sure this container is not running
web1
Please input the container name which you want to manage,or 'exit',or 'help'?: status
Running container:
CONTAINER ID        IMAGE                    COMMAND             CREATED             STATUS              PORTS                    NAMES
050ebb07cf25        training/webapp:latest   "python app.py"     14 minutes ago      Up 6 seconds        0.0.0.0:2000->5000/tcp   web1                   
0ef5d56e4c89        training/webapp:latest   "python app.py"     14 minutes ago      Up 14 minutes       0.0.0.0:1000->5000/tcp   web1/webbase,webbase   
Please input the container name which you want to manage,or 'exit',or 'help'?:

web1又启动了

delete容器web1(必须先把它关闭):

Please input the container name which you want to manage,or 'exit',or 'help'?: web1
Do you want to 'start' or 'stop' or 'delete' your container?: stop
Notice:container is stopping
web1
Please input the container name which you want to manage,or 'exit',or 'help'?: status
Running container:
CONTAINER ID        IMAGE                    COMMAND             CREATED             STATUS              PORTS                    NAMES
0ef5d56e4c89        training/webapp:latest   "python app.py"     15 minutes ago      Up 15 minutes       0.0.0.0:1000->5000/tcp   web1/webbase,webbase         #web1被关闭
Please input the container name which you want to manage,or 'exit',or 'help'?: web1
Do you want to 'start' or 'stop' or 'delete' your container?: delete
Notice:You cannot delete a running container,if the container is running,please stop it first!
web1
Please input the container name which you want to manage,or 'exit',or 'help'?: statusa
All infomation about containers:\n
CONTAINER ID        IMAGE                    COMMAND             CREATED             STATUS                     PORTS                    NAMES
0ef5d56e4c89        training/webapp:latest   "python app.py"     17 minutes ago      Up 17 minutes              0.0.0.0:1000->5000/tcp   webbase                 
4de1685a386e        training/webapp:latest   "/bin/bash"         37 hours ago        Exited (0) 37 hours ago                             backstabbing_lovelace   
c915cb516b02        training/webapp:latest   "python app.py"     37 hours ago        Exited (-1) 37 hours ago                            clever_mccarthy         #没有web1的相关信息了

web1被删除

tips:在manage会话下输入exit,将会返回主会话,再输入一次exit退出脚本:

root@docker:~# ./control.sh 
What you want to do?try input 'help' to get some tips(please input the words in ''): manage
Please input the container name which you want to manage,or 'exit',or 'help'?: exit                #退出manage会话
Exiting
What you want to do?try input 'help' to get some tips(please input the words in ''): exit          #主会话中退出
root@docker:~#

以上是“如何通过puppet管理远程docker容器”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!

网站标题:如何通过puppet管理远程docker容器
网页网址:https://www.cdcxhl.com/article18/ijgegp.html

成都网站建设公司_创新互联,为您提供面包屑导航微信小程序建站公司品牌网站制作网站设计Google

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

网站托管运营