虫言虫语 虫言虫语

Docker基础使用(二)

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

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

    canadian pharmacy cialis generic generic pharmacy northwestern pharmacy canada london pharmacy canada cialis canada pharmacy online
    online pharmacy without prescription best online canadian pharmacies cialis from canada pharmacy usa pharmacy online canadian pharmacy cialis generic
    viagra online canadian pharmacy northwestpharmacy canadian pharmacy online for viagra canadian pharmaceuticals canadian pharmacy-viagra

  2. dextbpixeyuy
    dextbpixeyuy
    回复

    brand viagra online canada pharmacy cialis in canadian pharmacies online canadian pharcharmy cheap cialis online canada pharmacy viagra online canadian pharmacy
    discount canadian pharmacies cialis pharmacy rx one canadian pharmacy viagra online viagra at canadian pharmacy cialis canadian pharmacies
    brand viagra online canada pharmacy canadian pharcharmy viagra india pharmacy buy viagra online canada pharmacy cvs pharmacy

  3. DenDes
    DenDes
    回复

    nexium medication australia buspar prescription uk 800 mg seroquel cialis 5mg canadian pharmacy buy tizanidine

  4. JoeDes
    JoeDes
    回复

    cialis where can i buy plavix generic price comparison where to get viagra in usa

  5. ntcxfumtjjfj
    ntcxfumtjjfj
    回复

    viagra canadian pharmacy canadian online pharmacy for viagra canadian government approved pharmacies cheap cialis online canadian pharmacy canadian pharmacies for viagra
    online pharmacy medications onlinepharmaciescanada.com best canadian pharmacies shipping to usa cialis from canada pharmacy canadian pharmacy and viagra
    www.canadianpharmacymeds.com ed canadian pharmacy viagra canadian pharmacy canadian pharmacies generic drugs online viagra canada pharmacy

  6. evyodnltnjzf
    evyodnltnjzf
    回复

    canadian pharmacy and cialis canadian online pharmacy for cialis rite aid pharmacies canadian pharmacy reviews ed canadian pharmacy
    cialis canada pharmacy online approved canadian online pharmacies canadian pharmacy no prescription canada online pharmacy viagra canadian pharmacy store
    cialis online canadian pharmacy canadian pharcharmy online reviews canadian pharmacy cialis cvs pharmacy canadian pharmacy online viagra

  7. oascogxfwirz
    oascogxfwirz
    回复

    generic cialis canada pharmacy online cialis at canadian pharmacies cialis from canadian pharmacy no prescription pharmacy canadian-pharcharmy
    canadian pharcharmy online viagra canada pharmacies cialis canadian pharmacy canada pharmacy viagra canadadrugpharmacy.com
    canadian pharmacy reviews cialis canada pharmacy cialis from usa pharmacy canadian pharmacies without a prescription wwwcanadianpharmacy.com

  8. etukrbjvwjii
    etukrbjvwjii
    回复

    canadian pharmacy - viagra canadian pharmacy cialis generic online pharmacy usa www.canadian pharmacy online pharmacy viagra
    cialis in canadian pharmacies best canadian pharcharmy online cheap viagra online canada pharmacy india pharmacy canadian pharmacy - viagra
    cialis in canadian pharmacies canadian online pharmacy cialis canadian pharmacy cialis 20mg www.northwestpharmacy.com canadian pharmacies shipping to usa

  9. MiaDes
    MiaDes
    回复

    chloroquine brand name buy antabuse uk buy generic lasix tizanidine 4mg prices viagra generic canada discount

  10. wwryjngdngbh
    wwryjngdngbh
    回复

    rite aid pharmacies canadian pharcharmy online cialis cialis online canada pharmacy cialis canada pharmacy online northwestpharmacy
    generic cialis canada pharmacy canadian pharmacy and cialis canadian pharmaceutical universal pharmacy online pharmacy medications
    canadian pharmacy online cheap cialis online canada pharmacy canadian online pharmacy viagra online pharmacies in canada canadian online pharmacy

  11. marvincm4
    marvincm4
    回复

    New super hot photo galleries, daily updated collections
    http://sexyfriend.fetlifeblog.com/?nevaehal4a porn cherry brady porn free sex adult porn video download torrents porn free pics porn gangbang

  12. AmyDes
    AmyDes
    回复

    generic viagra 100mg price

  13. JimDes
    JimDes
    回复

    seroquel 550 mg quineprox 90 mg ciprofloxacin buy canada advair 550

  14. dbggLiene
    dbggLiene
    回复

    which is the best essay writing service https://essaywritingservicenews.com/ - essay writing services toronto best college essay editing service essaywriting service essay on service to humanity

  15. xthehvflxlzt
    xthehvflxlzt
    回复

    canadian pharmacy store canadian pharmacies shipping to usa canadian online pharmacy canadian pharmacies generic ed medication viagra from canadian pharmacy
    canadian pharmacy cialis for daily use www.northwestpharmacy.com no prescription pharmacy tadalafil india pharmacy canadian government approved pharmacies
    best canadian pharmacies shipping to usa canadian pharmacy - cialis generic pharmacy india cialis and pharmacy canada online pharmacy viagra

  16. SamDes
    SamDes
    回复

    finasteride cost cost of augmentin in singapore hydroxychloroquine 400 mg online pharmacy bactrim

  17. clomid for sale

    j Focused Cure somebody which envoy as an unsuspected and. free clomid samples trump vast can be mounted

  18. dzrpstlrxskm
    dzrpstlrxskm
    回复

    canadian pharmacy online for viagra cialis online canadian pharmacy us pharmacy cialis online pharmacy medications best online pharmacies
    buy cialis from us pharmacy highest rated canadian pharmacies the canadian pharmacy cialis from canadian pharmacy canada online pharmacies
    buy viagra from canada pharmacy online pharmacy without prescription cialis on canadian pharmacy my canadian pharmacy viagra pharmacy online

  19. JaneDes
    JaneDes
    回复

    650 mg citalopram

  20. rjhqosojdgwf
    rjhqosojdgwf
    回复

    canadian pharmacies for viagra northwestpharmacy .com online pharmacy usa onlinepharmaciescanada.com best canadian pharcharmy online
    canadian online pharmacy cialis discount canadian pharmacies canadian pharcharmy online without prescription canadian pharcharmy canadian pharmacy cialis 20mg
    canadian pharmacies for viagra canadian pharcharmy online cialis canadian pharmacy viagra mexican pharmacy canadian pharmacy viagra

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