虫言虫语 虫言虫语

Docker基础使用(二)

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

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

支付宝打赏

文章二维码

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

发表新评论
已有 16472 条评论
  1. JackDes
    JackDes
    回复

    lopressor tablet average price of zoloft where can i buy phenergan over the counter plavix best price cheap albenza cephalexin 800 mg arimidex cost generic

  2. JaneDes
    JaneDes
    回复

    valtrex online pharmacy india

  3. yefqyviysqih
    yefqyviysqih
    回复

    tadalafil buy cialis cheap prescription cialis cialis free tadalafil for sale
    cialis information tadalafil 20mg buy prescription drugs without doctor cialis 20 mg best price cialis daily cost
    average cost of cialis online cialis without prescription cialis without a doctor 20mg cialis for sale cialis canadian pharmacy brand cialis without a doctor's prescription
    kqpuypiblolw generic cialis canada walgreens cialis 20mg price cialis coupons cialis daily cost viagra without a doctor prescription

  4. AItashy
    AItashy
    回复

    cbd oil benefits cbdoilforsalex.com walgreens cbd products cbd oil cbd products cbd oil

  5. JimDes
    JimDes
    回复

    buy avana buy generic flagyl sildalis 120 mg order usa pharmacy soft tabs viagra motilium tablets price plaquenil buy

  6. MiaDes
    MiaDes
    回复

    advair disk hydrochlorothiazide 12.5mg ampicillin price uk nolvadex order purchase cymbalta online

  7. AItashy
    AItashy
    回复

    pure cbd oil cbd oil for pain buy cbd oil best cbd oil cbd oil benefits pure cbd oil

  8. IvyDes
    IvyDes
    回复

    buspar prescription uk buy generic strattera tadalafil price in canada dapoxetine no prescription plavix generic brand lexapro 150 mg lisinopril prescription cost baclofen 25mg anafranil drug prices tretinoin cream over the counter prazosin 2 mg capsule viagra otc mexico cephalexin 500mg capsules cost stromectol 3 mg tablet prozac brand propranolol oral finasteride cost in india ampicillin 250mg ivermectin cream uk nolvadex prescription australia

  9. JudyDes
    JudyDes
    回复

    cost of erythromycin gel amoxil 250 mg price generic viagra soft malegra 50 for sale avodart online can i buy prozac online bactrim no prescription colchicine 500 cost of generic proscar online order prednisone 10mg

  10. SueDes
    SueDes
    回复

    flagyl 250 ivermectin 12 buspar 45mg cheap inderal singulair discounts average cost of plaquenil lopressor brand name how to order advair from canada chloroquine phosphate brand name can you buy diclofenac tablets over the counter

  11. SueDes
    SueDes
    回复

    cephalexin 250mg where can i purchase acyclovir prazosin cost india buy buspar online uk dapoxetine buy us where to buy vermox in canada silagra 100 price in india buy levitra australia cleocin 150 mg price fluoxetine 10 mg price in india

  12. DenDes
    DenDes
    回复

    plaquenil pill strattera 2017 propranolol 10mg cheap where to buy azithromycin 500mg plavix 37.5 mg

  13. JackDes
    JackDes
    回复

    cytotec 200mcg tab generic viagra for sale online buspar price proscar price australia buy inderal 10mg phenergan canada order

  14. SusanEffog
    SusanEffog
    回复

    Meet a man for real meetings and sex!
    My nickname on the site Berta77
    https://cutt.us/instagram-girls

  15. gmgmhcgrreqb
    gmgmhcgrreqb
    回复

    cialis without a doctor how to get cialis without doctor ceilas for sale cialis buy cialis 20 mg walmart price
    tadalafil without prescription online cialis pharmacy generic tadalafil levitra without a doctor prescription cialis 40 mg best results
    buy cialis online.com discount tadalafil is there a generic cialis? cialis .com cheapest cialis online viagra & cialis
    csixighdgbvc cialis daily canadian cialis online pharmacy cialis brand generic viagra without a doctor prescription is there a generic cialis?

  16. JaneDes
    JaneDes
    回复

    levitra india online

  17. JaneDes
    JaneDes
    回复

    stromectol ebay

  18. JackDes
    JackDes
    回复

    buy fluoxetine india tetracycline medicine in india seroquel for children medicine medrol 40mg lasix cost generic for hydroxychloroquine 200 mg vardenafil hcl 20mg

  19. SueDes
    SueDes
    回复

    gabapentin online usa anafranil pills for sale 10mg baclofen tablet price dipyridamole brand lisinopril prices advair 250 mg wellbutrin 150 mg coupon furosemide 20mg tablets cost generic estrace cream usa prednisolone best price

  20. PaulDes
    PaulDes
    回复

    how much is elimite cream can you buy ampicillin clonidine hcl 0.1 zoloft generic tablet generic tadalafil pills

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