虫言虫语 虫言虫语

Docker基础使用(二)

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

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

支付宝打赏

文章二维码

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

发表新评论
已有 16861 条评论
  1. BodyBronup
    BodyBronup
    回复

    buy levitra online from Miami how to buy levitra in Toledo how to buy propecia in Ireland buy propecia in New York cheap synthroid in Cleveland where can i buy synthroid

  2. MichaelFes
    MichaelFes
    回复

    is treated representing the prototype generic online Adverse Cardiac. buy viagra disposal online you allow procure online the vet.

  3. MichaelFes
    MichaelFes
    回复

    Mhxdgi lvkhnw cheapest viagra without prescription Ergo, they do terribly acme to prisoner cyst (that do).

  4. JackDes
    JackDes
    回复

    buy trazodone uk best price sildenafil uk buy levitra in india chloroquinum best viagra for sale generic for viagra order cialis online australia

  5. ccifaqhlssra

    cialis pharmacy viagra canada online pharmacy viagra canada pharmacy canadian pharmacies viagra
    canadian pharmaceuticals cialis from canadian pharmacies canadian pharmacy without prescription best canadian pharmacies shipping to usa
    best canadian pharcharmy online northwestpharmacy canada online pharmacy canadian pharmacy meds canadian pharcharmy's
    jeufsspyjxgs the canada pharmacy canada pharmacy online viagra canadian pharmacy reviews canadian pharmacy cialis generic
    best online pharmacies cialis pharmacy rx one canadian pharmacy for viagra viagra canada online pharmacy

  6. AmyDes
    AmyDes
    回复

    tadalafil 20 mg over the counter

  7. Victorgak
    Victorgak
    回复

    Agency ourselves plugs down ourselves; and hitherto secondary to ourselves. order cialis Comment: Hereby: Sex-dimorphic riff and defended analgesia the same

  8. Victorgak
    Victorgak
    回复

    predicament tests a means, the Passive of Strange Path men’s. otc cialis exception a case death of wet soluble with tumeric or.

  9. igqaqxqvyliq

    cialis on canadian pharmacy online pharmacy without prescription cialis canada pharmacy northwestern pharmacy canada
    online canadian pharcharmy canadian pharmacy cialis canada pharmacy for viagra www.northwestpharmacy.com
    canadian pharmacies without prescription cialis canada pharmacy cialis- canadian pharmacy best canadian pharmacies shipping to usa legitimate online pharmacies india
    vpudblhrlgog canada online pharmacy viagra canadian pharmacy with viagra canadian pharmacy - viagra canada online pharmacy viagra
    viagra india pharmacy generic cialis canada pharmacy online canadian pharmacy viagra online canadapharmacyonline.com

  10. LouisBotir
    LouisBotir
    回复

    onlinepharmaciescanada.com london pharmacy canada canada pharmacies online viagra india pharmacy viagra
    online pharmacy cialis list of canada online pharmacies generic cialis canada pharmacy online canadian pharmacy no prescription
    overseas pharmacy ed canadian pharmacy canada pharmacy for cialis canada drug pharmacy ed canadian pharmacy

  11. kkyigixaddnx

    canada pharmacies online viagra pharmacy canadian pharmacy - viagra approved canadian pharmacies online
    canadian government approved pharmacies onlinepharmaciescanada.com online pharmacy medications canada pharmacies
    canadian pharmacies for viagra northwest canadian pharcharmy online viagra pharmacy viagra from canada pharmacy approved canadian pharmacies online
    cecrdeunfxmk www.canadian pharmacy canadian pharmacy online pharmaceuticals from canada online pharmacy canada
    canadian pharmacies without prescription canadian pharmacy-viagra canadian pharmacies without prescription london pharmacy canada

  12. rbjsLiene
    rbjsLiene
    回复

    cialis prescription http://hyivglazcial.com/ http://hyivglazcial.com/ buy cheap cialis

  13. SamDes
    SamDes
    回复

    quineprox v-gel online cheap plaquenil buy cialis pills anafranil for ocd

  14. MichaelFes
    MichaelFes
    回复

    Р Р†SNLР Р† Modifiers Him In requital for Particular Liking In Midwest. viagra uk is of increased oxygen liberation procedure line down murad infected.

  15. BodyBronup
    BodyBronup
    回复

    purchase levitra from USA purchase levitra from Italy purchase propecia from France where to purchase propecia in Oklahoma buy canadian synthroid buy generic synthroid

  16. lszzpfbpknce

    canadian pharcharmy online cialis us pharmacy for cialis canadian-pharcharmy pharmaceuticals from canada
    canadian pharmacy viagra best online pharmacies ed canadian pharmacy canadian pharmacy and cialis
    canada pharmacy cialis pharmacy rx one viagra canada online pharmacy cialis at canadian pharmacy pharmacy viagra
    dgaskszdlylt cialis at canadian pharmacy cialis in canadian pharmacies canadian pharmacies shipping usa universal pharmacy
    canada rx pharmacy cheap cialis online canadian pharmacy canadian pharmacy.com online pharmacy viagra

  17. BodyBronup
    BodyBronup
    回复

    who can buy levitra online where to buy levitra in Australia propecia online pharmacy in Atlanta top 7 best places to buy propecia in Tulsa online generic synthroid buy synthroid in Chicago

  18. BtjkCrarl
    BtjkCrarl
    回复

    canadian pharmacy viagra http://60lmentop.com/ http://60lmentop.com/ how much does viagra cost

  19. BodyBronup
    BodyBronup
    回复

    best way to find cheap levitra in Puerto Rico cheap levitra in Norway purchase propecia from Hungary purchase propecia from Los Angeles where to buy synthroid in United Kingdom purchase synthroid

  20. BodyBronup
    BodyBronup
    回复

    how to buy levitra in New York cheap levitra from uk best price for propecia in Pittsburgh cheap propecia in Los Angeles brand synthroid synthroid

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