虫言虫语 虫言虫语

Docker基础使用(二)

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

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

支付宝打赏

文章二维码

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

发表新评论
已有 14394 条评论
  1. KimDes
    KimDes
    回复

    cheap sildalis

  2. byqwiodmjmlj
    byqwiodmjmlj
    回复

    cialis online without prescription cialis 20 mg walmart price viagra cialis where to buy cialis online cialis 10mg vs 20mg
    buy generic cialis online is there a generic cialis viagra cialis brand cialis online cialis free trial
    cialis viagra when to take cialis how much does cialis cost at walmart cialis tablets buy cialis without prescription generic cialis in usa
    qjbzkpgsvzyu cialis from canada tadalafil walmart cialis generic cialis prescription online cialis on sale in usa

  3. SueDes
    SueDes
    回复

    price of nolvadex ventolin prescription australia triamterene 37.5mg hctz 25mg atenolol medication ivermectin 10 ml cytotec price in singapore best price malegra fxt canada generic prozac fluoxetine bactrim price australia acyclovir medicine

  4. xarkcqswvweb
    xarkcqswvweb
    回复

    real cialis buy cialis in the usa female cialis cialis walmart price cialis. com
    brand cialis without a doctor's prescription cialis. com cheap generic cialis cialis pills for men best price on cialis 20mg
    can you buy cialis online best price on cialis 20mg generic cialis without a prescription cialis online no prescription viagra without a doctor prescription cyalis
    upfahmljtcft cost of cialis canadian pharmacies shipping to usa cialis over the counter cialis usa where can i buy cialis

  5. KimDes
    KimDes
    回复

    finpecia 1mg

  6. MarkDes
    MarkDes
    回复

    aralen medication toradol for headaches anafranil pills

  7. Weirobete
    Weirobete
    回复

    3bdb21 viagra ou autreshttps://viagraonlinegfsd.com/ - viagra onlinebest site to purchase viagrahttps://viagrashippingtoday.com/ - buy viagratry it mail order viagra chinahttps://viagratodaybest.com/ - viagra without doctor prescriptionindia for pills in viagrahttps://viagratodo20.com/ - can you buy viagra over the counter

  8. buy cialis generic

    149) I'm a omnium gatherum and started my subvene constraints a reasonable. slots online online casinos

  9. EyeDes
    EyeDes
    回复

    cipro 500 mg tablet price advair 500 cost strattera 80 mg coupon cymbalta drug coupon generic albenza cost best otc tretinoin sumycin drug seroquel 1200 mg ordering atenolol online price of toradol ampicillin sodium viagra 50 mg tablet price price of propranolol in us baclofen 15 mg prednisolone 5mg price antabuse medication triamterene hctz 37.5 25 mg tb clomid otc drug lasix 40mg tablet price tetracycline prescription cost

  10. KimDes
    KimDes
    回复

    best prices advair

  11. IvyDes
    IvyDes
    回复

    amoxil 875 medication dapoxetine buy canada can you buy finasteride over the counter vardenafil brand fluoxetine 30 mg capsules uk cipro prescription cost can you buy azithromycin otc malegra 100 gel finpecia online india trazodone without prescription in canada buy avana ivermectin usa buy priligy online uk antabuse-the no drinking drug allopurinol in usa generic cost of prozac tetracycline prescription acyclovir cream price south africa advair 2018 coupon dipyridamole where to buy

  12. PaulDes
    PaulDes
    回复

    disulfiram india online albenza for pinworms viagra brand canada medrol 40 mg tablet purchase erythromycin 500mg canada

  13. KimDes
    KimDes
    回复

    best tretinoin brand india

  14. KimDes
    KimDes
    回复

    lipitor 20

  15. mmbvcvrplabz
    mmbvcvrplabz
    回复

    when to take cialis www cialis com brand cialis buy cialis from usa meds without a doctor's prescription
    online cialis without prescription cost of cialis how does cialis work online cialis without prescription cialis 5mg
    online pharmacy cialis is there generic cialis how to get cialis without doctor online cialis without a prescription cialis order online cialis trial
    xxzdwscwbttm how does cialis work cialis with no prescription online cialis without a prescription tadacip online side effects of cialis

  16. WimDes
    WimDes
    回复

    propecia cost in canada

  17. lezvujhdrtui
    lezvujhdrtui
    回复

    buy prescription drugs without doctor tadalafil walmart cialis on line no pres buy cialis online cialis generic
    tadalafil best price free cialis trial online prescription for cialis is there a generic for cialis www cialis.com
    cialis vs viagra reviews cialis.com free sample adcirca vs cialis female cialis cialis from usa cialis 20 mg best price
    kthvargiejud cialis coupons printable where can i buy cialis buy cialis without prescription mail-order cialis cialis for sale

  18. IvyDes
    IvyDes
    回复

    sumycin drug dipyridamole brand furosemide canada dapoxetine 60 mg in usa can i buy wellbutrin online triamterene 37.5 mg tab 1mg estrace pill tretinoin 0.1 zoloft price in usa buy amoxicillin 250mg valtrex tablets tetracycline cream anafranil 100 mg arimidex 1mg price in india cymbalta 200mg diclofenac 1 topical gel trazodone 50 mg tablet brand name no prescription lisinopril robaxin 750 canadian pharmacy cialis no prescription

  19. wdriLiene
    wdriLiene
    回复

    п»їcialis http://cialishe.com/ - generic cialis cialis online cialis generic buy cialis

  20. JackDes
    JackDes
    回复

    vardenafil 20mg price zithromax buying strattera cost in mexico antabuse price us singulair 4 mg medrol tablets india lasix medication clonidine prescription cost

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