虫言虫语 虫言虫语

Docker基础使用(二)

in Dockerread (56034) 文章转载请注明来源!

在配置镜像之后可以进行docker的基础使用如
使用docker run XXXXX 来运行某个容器

我选择的使用docker-compose,相对更加简单简洁。

首先指定版本号

#选择2号对应新版本的docker
version: '2'
#开始定义服务
services:
  mysql:
    #mysql服务创建
    #image可以在hub.docker.com查询到对应的image名,这里推荐指定版本来保证环境的一致性,不会因为镜像升级使得环境出现问题
    image: "mysql:5.7.19"
    environment:
      MYSQL_ROOT_PASSWORD: "ROOT" 
      MYSQL_DATABASE: "docker"
      MYSQL_USER: "wormw"
      MYSQL_PASSWORD: "wormw"
    volumes:
    #信息后进行储存位置的映射储存,使产生的数据得到储存,而不是存储在内存中,当容器结束后数据就消失
      - ./db:/var/lib/mysql
    
  php:
    #利用dockerfile创建php7-fpm,主要是由于php需要加载许多第三方插件,直接加载image可能无法满足需求
    build:
    #context填写的是dockerfile的路径
      context: ./conf/php7
      dockerfile: Dockerfile
    volumes:
    #与上面的情况类似,这里加载volumes是为了让容器可以运行容器外的php程序,所以将目录进行了关联
      - ./web:/mnt/web
  web:
    #创建nginx服务,同时依赖php服务
    image: nginx
    volumes:
    #将本地配置文件通过映射关联给容器,实现对容器的配置
      - ./conf/nginx/config:/etc/nginx/conf.d
    ports:
    #绑定宿主机的80端口
      - "80:80"
    depends_on:
    #依赖php服务,实现容器间互相访问
      - php
    volumes_from:
    #访问php的本地卷
      - php
    networks: 
    #加入建立的网络中,实现容器间的互访
      - shared_net
    
  redis:
    image: redis:3.2.10
    ports:
      - "6379:6379"



  networks:
    #创建刚才引用的网络,将需要进行互联的容器加入同一网络中
    shared_net:
        external: true
    
jrotty WeChat Pay

微信打赏

jrotty Alipay

支付宝打赏

文章二维码

扫描二维码,在手机上阅读!

发表新评论
已有 10946 条评论
  1. Brianrenly
    Brianrenly
    回复

    go right here go to website agree with

  2. SueDes
    SueDes
    回复

    amoxicillin 500 mg online buy generic arimidex generic valtrex for sale propranolol 80 mg capsules prescription cost viagra baclofen 10 price seroquel 12.5 cost of ampicillin medrol 16 lipitor 10mg tablet price

  3. oytjdaoinaaq
    oytjdaoinaaq
    回复

    cialis from canada pharmacy lyxopsexkwmo generic cialis from canada get a prescription online buy viagra online canada pharmacy canadian pharmacy viagra viagra canada
    canada drug store jrpquqnxmrzz buy viagra online canada pharmacy canada meds buy cialis online canada canadian pharmacies shipping usa prescriptions from canada
    rx online yklqaubwsiii canadian pharmacy canadian prescription drugs online drugs buy cialis online pharmacy cialis in canada
    how to buy cialis online from canada iekktbrntwgg cialis online canada northwest pharmacy canada canada drug store canadadrugpharmacy.com cialis online canada

  4. MiaDes
    MiaDes
    回复

    12.5mg furosemide buy lisinopril uk where to buy cheap albenza toradol 10 mg tablet cost tadalafil medicine

  5. AmyDes
    AmyDes
    回复

    disulfiram uk buy

  6. MichaelBes
    MichaelBes
    回复

    Проект позволяет анонимно и безопасно покупать\продавать
    запрещенные товары сообразно всей РФ и СНГ. Укладистый функционал
    делает план качественным инструментом чтобы работы, а
    внимательная и справедливая власть выступает регулятором
    взаимоотношений продавец-покупатель, делая покупки удобными
    для клиентов.
    гидра сайт
    сайт гидра магазин закладок

  7. MiaDes
    MiaDes
    回复

    atenolol 787 inderal tablets 40mg buy malegra dxt plaquenil cost canada generic lipitor online

  8. Brianrenly
    Brianrenly
    回复

    sites read full article over at this website

  9. Karolinaobete

    preise is pfizer53e7 is online in malaysia53e7 is no isurance cost53e7

  10. JackDes
    JackDes
    回复

    tretinoin 1.0 where can i get proscar purchase clonidine metformin glucophage xr

  11. Williamseall
    Williamseall
    回复

    agel viagra http://viagrazum.com/# - online generic viagra viagra grubu buy real viagra online viagra en france sans ordonnance

  12. MiaDes
    MiaDes
    回复

    hydroxychloroquine sulfate australia buy trazodone online uk acyclovir 400 mg price in india flagyl tablets 200mg ventolin capsule

  13. Aliiobete
    Aliiobete
    回复

    cost of is 100mg in canadacdb6 uk is shopcdb6

  14. MiaDes
    MiaDes
    回复

    medrol 4 pill cephalexin no prescription prices generic bactrim for sale finpecia online phenergan tablets online

  15. Zheglovobete
    Zheglovobete
    回复

    at is canada0584 kaufen is erfahrungen0584 usage of is tablets0584 west kanye is up stay0584

  16. Amaiahobete

    is without priscription99a2 venta de is en argentina99a2

  17. JoeDes
    JoeDes
    回复

    phenergan 25 mg prescription zofran 50 mg prescription priligy medicine diclofenac sodium 50 mg

  18. JaneDes
    JaneDes
    回复

    tretinoin 0.025 cream australia

  19. mamaligadoc
    mamaligadoc
    回复

    1967DENDENHEREAM333Docker????(?) - ????
    online pharmacy Calan Sr in Ireland order cheap Calan Sr in Canada with VISA or MasterCard ; order at low price Calan Sr in USA
    Calan Sr in UK next day NO PRESCRIPTION needed
    low prices for generic Calan Sr in Ireland
    Calan Sr with credit card NO PRESCRIPTIONDocker????(?) - ????BUY CHEAP HERE! ENTER HERE! https://bit.ly/usamedsonlineDocker????(?) - ????http://www.tdedchangair.com/webboard/viewtopic.php?f=2&t=145055
    http://www.tdedchangair.com/webboard/viewtopic.php?f=2&t=146666
    http://wdntw.com/viewtopic.php?f=10&t=520923
    http://mrssodhi.com/discussions/showthread.php?tid=105795
    http://www.easyconvo.com/talk/threads/july-2020-leaks-dion-blues-with-friends-2-lp-leak-album.303016/#post-867271
    Cheapest Cialis Daily in in UK/GB;c.o.d. no script
    http://newtopassau.com/viewtopic.php?pid=586457#p586457
    http://www.tdedchangair.com/webboard/viewtopic.php?f=2&t=146875
    http://www.tdedchangair.com/webboard/viewtopic.php?f=2&t=149609
    http://nutritionpersonalized.com/forum/viewtopic.php?f=4&t=139311&p=809176#p809176
    http://fotografhaberleri.net/forum/showthread.php?tid=555807
    http://faggotland.club/viewtopic.php?f=2&t=485193
    Buy cheap Mysoline in in UK/GB;in AUSTRALIA c.o.d. saturday delivery
    http://thedarkspade.com/viewtopic.php?f=11&t=530679
    http://faggotland.club/viewtopic.php?f=2&t=489686
    http://www.tdedchangair.com/webboard/viewtopic.php?f=2&t=144782
    http://www.e-tahmin.com/para-yatirma-yontemleri/78-otopay-ile-para-yatirma-3.html#post15564
    http://shen500kapp.me/500KAppForum/viewtopic.php?f=11&t=335850
    Cheap Avodart in in USA;no prescriptions needed
    http://faggotland.club/viewtopic.php?f=2&t=483702
    Buy discount Tadalis SX in in NEW ZELAND;from INDIA no prescription pharmacy
    Cheapest Pepcid in in AUSTRALIA;in UK/GB no prescription needed
    Cheapest prices Decadron in in NEW ZELAND;from INDIA same day delivery no prescription
    http://motioncontrol.cn/bbs/forum.php?mod=viewthread&tid=19&pid=235849&page=604&extra=page%3D1#pid235849
    http://www.crusaders-cagliari.it/forum/welcome-mat/46538-price-of-zyprexa-in-usa-no-rx-required.html#46596
    https://forum.mascoop.org/index.php/topic,214077.new.html#new
    http://assosaclaybourg.free.fr/viewtopic.php?f=18&t=773

  20. LisaDes
    LisaDes
    回复

    glucophage cost india

博客已萌萌哒运行
© 2020 由 Typecho 强力驱动.Theme by Yodu
前篇 后篇
雷姆
拉姆