虫言虫语 虫言虫语

Docker基础使用(二)

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

在配置镜像之后可以进行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

支付宝打赏

文章二维码

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

发表新评论
已有 6867 条评论
  1. RafSeinaclecoca

    hemp oil http://buycbdoilonline.us.com/ hemp cbd oil cbd oil for sale cbd

  2. DavidDok
    DavidDok
    回复

    바카라사이트바카라사이트

  3. canadian pharmacy

    no prior prescription required pharmacy
    http://canadianonlinepharmacyoffer.com/
    canadian pharmacies online

  4. MiaDes
    MiaDes
    回复

    lasix 40 mg tablet buy trazodone buy cozaar online amoxicillin pills 500 mg buy tretinoin gel

  5. Best Payday Loan

    debt consolidation companies

  6. bfbnFaulP
    bfbnFaulP
    回复

    buy viagra https://sexviagen.com/ - viagra generic generic viagra viagra viagra without doctor prescription

  7. no prior prescription required pharmacy

    canada pharmacies online prescriptions
    http://canadiantrustmedpharmacy.com/
    buy prescription drugs without doctor

  8. no prescription pharmacy canada

    pharmacy without dr prescriptions
    http://canadiantrustmedpharmacy.com/
    pharcharmy online no precipitation

  9. Veraobete
    Veraobete
    回复

    http://technewsdestination.com/2019/07/31/sex-tech-startups-band-together-to-protest-facebooks-ad-policies-techcrunch/?unapproved=33186&moderation-hash=1766a73cf766c2625d8f25f28e75f0f7 - cialischeap cialishttp://blog.enguruapp.com/?p=599&unapproved=12875&moderation-hash=9a60b236d2b425d4d0cc6535f016d736 - cialiscialis onlinehttp://39bola.live/2020/02/29/hasil-liga-champions-olympique-lyonnais-vs-juventus/?unapproved=5688&moderation-hash=0ee4a21b5cec1e9f87a74da892706e35 - cialiscialishttp://chroniquestchatcha.congo-awa.com/2020/03/03/payday-loans-%e2%87%92-borrow-up-to-1000-%e2%87%92-simple-online-29/?unapproved=729&moderation-hash=050eb499142a86d0c5e301e47e666ab0 - cialiscialis onlinehttp://www.cheaterblock.com/2020/03/13/cynjnyck/?unapproved=246087&moderation-hash=04c15be1e239c01f3bb44f092a862f51 - buy viagraviagra onlinehttp://maks12345.biz.ua/voidplay-virus-market/?unapproved=112666&moderation-hash=a984627ee58c88297fe12b204101b0f7 - cheap viagrabuy viagrahttps://songkhoe247.com.vn/ha-khang-duong/?unapproved=2766&moderation-hash=399616af12776bafdcece8b8aeeef358 - cialischeap cialishttps://gigging.co.uk/index.php/2019/03/28/what-is-fiverr/?unapproved=35&moderation-hash=029ccda45f55800c979e042d35d07a63 - cheap cialiscialis online

  10. RafSeinaclecoca

    hemp cbd oil http://buycbdoilonline.us.com/ - cbd store cbd cream hemp cbd oil pure cbd oil

  11. Videlobete
    Videlobete
    回复

    https://gilishop.ir/%d8%b7%d8%b1%d8%b2-%d8%aa%d9%87%db%8c%d9%87-%d9%be%d9%86%db%8c%d8%b1-%d8%a8%d8%b1%d8%b4%d8%aa%d9%87-%da%af%db%8c%d9%84%d8%a7%d9%86%db%8c/comment-page-2/?unapproved=4567&moderation-hash=dbb073d6bd7119f0399c520a53474e5a - cheap viagraviagrahttps://for-motion.com/en_GB/a-review-of-the-telling-statistics-of-payday/?unapproved=104&moderation-hash=87620911e0f0afbf40e74fc9c99cca8d - viagraviagrahttps://moscars.net/2019/01/27/hello-world/?unapproved=5772&moderation-hash=decc47bd00e731110397b58ca56073d2 - cialis onlinebuy cialishttps://ocbnnannaco.com/2020/03/03/you-could-see-your-rate-then-apply-31/?unapproved=4366&moderation-hash=80d531e06dbad0286bee008ac07f63b0 - cialischeap cialishttps://333asia.com/casino-online-tips-bermain-baccarat-online/?unapproved=79599&moderation-hash=c3553d74f7c935df57528040fa6bc0a9 - cheap cialisbuy cialishttp://www.heyhobo.com/nicolette-gersh-tampa-florida/?unapproved=2278&moderation-hash=629b5a5723a06f6fcc42493143cfcee2 - viagrabuy viagrahttps://chothapcam.net/tai-sao-nen-su-dung-my-pham-mocha-de-lam-dep/?unapproved=923&moderation-hash=4dd1f68b40576b13b64040af45be1e41 - buy cialisbuy cialis

  12. GasonDyets
    GasonDyets
    回复

    Our Drug Prices are 70% less than your local pharmacyOur online pharmacy is the leader in delivering medications throughout the world.
    Our goal is to provide medications at discount rates to everyone who is affected by expensive local prices.
    Our company is a professionally managed distributor of generic drugs.
    We provide high-quality service supplying drugs all over the world.
    link ---> http://tiny.cc/drugstore

  13. canadian online pharmacies

    legitimate canadian pharmacies
    http://canadianonlinepharmacywest.com/
    best online international pharmacies

  14. canadian pharmacy online

    safe online pharmacies in canada
    http://canadianonlinepharmacywest.com/
    online drugstore

  15. motorevato
    motorevato
    回复

    Посмотреть Мерседес GL 400 2014 Аккумулятор или Аккумулятор ниссан Almera 3.5
    Аккумулятор на ALMERA Classic B10 2.5https://moscowakb.ru/shop/

  16. online pharmacies canada

    best 10 online pharmacies
    http://canadianonlinepharmacyelite.com/
    canadian online pharmacies

  17. MarkDes
    MarkDes
    回复

    generic prednisolone generic paxil prozac 2018 zithromax 250 price tetracycline over the counter

  18. legitimate online pharmacies

    approved canadian pharmacies online
    http://canadianonlinepharmacyelite.com/
    online pharmacies

  19. JasonDes
    JasonDes
    回复

    tetracycline price metformin 500 buy albuterol amoxicillin online canada buy kamagra amoxil buy online citalopram 10 mg tablet cost buy augmentin buy tretinoin prednisone prescription online

  20. vsbhabaxy
    vsbhabaxy
    回复

    online viagra https://genericjojos.com/ - online viagra buy viagra viagra without doctor prescription viagra

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