虫言虫语 虫言虫语

Docker基础使用(二)

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

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

支付宝打赏

文章二维码

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

发表新评论
已有 14398 条评论
  1. public tax records nc

    tarrant county public record public records ny public records inmate search glynn county public records
    upshur county public records rockford il public records public records act victoria waukegan public records

  2. KimDes
    KimDes
    回复

    best price malegra fxt

  3. SueDes
    SueDes
    回复

    aralen generic 1 mg proscar price hydrochlorothiazide 12.5 mg over the counter advair diskus cheap cytotec 100 mcg disulfiram price india buy buspar online cheap paxil 100mg valtrex 50 mg lopressor

  4. Aobjenbak
    Aobjenbak
    回复

    treat coronavirus symptoms antiviral medication for shingles famvir en linea farmacia comprar viagra generico comprarviagra.uno antiviral drug for influenza virus. antiviral medicine for influenza antiviral meds for shingles 2021 9b1bbfd , antiviral drug definition. how antiviral kill viruses, is there antiviral medication for the flu.
    En linea farmacia la comprar viagra sin receta successfully to tackle coronavirus, can yeast infection treatment cause spotting. putting cities on shutdown mode, can yeast infection treatment cause spotting coronavirus antiviral medication. Online farmacia comprar tadalafil site Coronavirus outbreak, antiviral medicine over the counter. does yeast infection treatment cause discharge, COVID-19 Prevention and Treatment antiviral medications herpes.

  5. PaulDes
    PaulDes
    回复

    tetracycline for sale no prescription cost for propecia 450mg wellbutrin azithromycin 500 mg tabs clonidine 25 mcg

  6. qakqqfgzjiaa
    qakqqfgzjiaa
    回复

    buy medication without an rx calais pills from canada generic cialis usa generic viagra without a doctor prescription securetabs
    discount tadalafil best cialis prices best price on cialis 20mg best cialis dosage cialis daily cost
    walmart cialis buy cialis in the usa cialis 20mg price celiasis cialis online without a prescription walmart cialis prices without insurance
    qdmskinttapa is there a generic cialis? daily cialis www cialis com cialis no prescription generic cialis reviews

  7. DenDes
    DenDes
    回复

    where can i buy seroquel online ivermectin 3mg wellbutrin 10 mg cost buy online zithromax buy finpecia

  8. IvyDes
    IvyDes
    回复

    propecia cheap trazodone prescription medicine sumycin drug over the counter allopurinol in mexico dipyridamole tablet 25mg prednisolone brand name uk robaxin 750 cost buy cheap silagra buy nolvadex tamoxifen citrate cipro 500 mg tablet bactrim price where can i buy clomid 100mg can i buy viagra generic in canada buy diclofenac gel online india phenergan pill 25 mg hydroxychloroquine coupon clonidine tablets uk generic for cephalexin erythromycin 600 mg chloroquine prescription

  9. JimDes
    JimDes
    回复

    tadalafil rx hydrochlorothiazide losartan erythromycin 500 mg cost nivaquine-p dapoxetine 1mg

  10. Brianrenly
    Brianrenly
    回复

    this content hop over to this web-site click here now

  11. Brianrenly
    Brianrenly
    回复

    read this look at this website Get the facts

  12. Brianrenly
    Brianrenly
    回复

    Web Site click here for more see page

  13. Brianrenly
    Brianrenly
    回复

    the advantage click reference homepage

  14. adamah69
    adamah69
    回复

    Best Nude Playmates & Centerfolds, Beautiful galleries daily updates
    http://drunk.lesbians.hotblognetwork.com/?keelyporn star sky web cam ass porn carmella bing pebbles and bam bam porn live porn chat for women saskia bb porn

  15. Stacyfet
    Stacyfet
    回复

    Have you ever tried cybersex? Let’s give each other pleasure tonight! Click the link - https://cutt.us/ass2020 My nickname is Stella

  16. cialis buy
    cialis buy
    回复

    To doff a aware ensemble with held, in septic and treatment management. online casino online casinos real money

  17. JackDes
    JackDes
    回复

    strattera prescription drug how much is arimidex cost cost of atenolol uk advair 500 generic

  18. ACrorgo
    ACrorgo
    回复

    viagra pills viagra for sale sildenafil 20 mg tablet vs viagra viagra generic http://viagroforsale.com/ sildenafil 20 mg tablet vs viagra

  19. iazqxfbjqeqt
    iazqxfbjqeqt
    回复

    canada viagra fwdhmwzvbqbb online pharmacy for cialis walmart drug prices canadian online pharmacies cheap viagra canada get a prescription online
    www.northwestpharmacy.com jzmwawdmunbh ed drugs online canadian pharmacies canada pharmacy medications com cialis and canada
    buy cialis from canada online wegdxfpdfazl canada drug generic cialis to canada buy cialis canada online canadian pharmacy online buy cialis online pharmacybuy cialis from canada online cheap drugs how to buy cialis online from canada

  20. MiaDes
    MiaDes
    回复

    online valtrex plaquenil pill tadalafil prescription canada order tetracycline without a prescription albendazole cost

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