虫言虫语 虫言虫语

Docker基础使用(二)

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

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

支付宝打赏

文章二维码

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

发表新评论
已有 16858 条评论
  1. ehcnadnbofaw

    canadian pharmacy online viagra canadian pharmacy online for viagra viagra pharmacy cialis canadian pharmacies
    viagra from canada pharmacy best canadian pharmacies shipping to usa cialis canada pharmacy online cialis on canadian pharmacy
    viagra from canada pharmacy canadian pharmacy store canadian-pharmacy-online cialis online canada pharmacy my canadian pharmacies
    dkjiefstzzkm canadian pharcharmy list of canada online pharmacies online pharmacy canada best online canadian pharmacies
    canada pharmacies online prescriptions canada rx pharmacy online pharmacy canada canadian pharmaceuticals

  2. CarlosWeeva

    киевстар деньги переводи на картукак снять деньги с телефона

  3. ydzbeszayqcv

    generic cialis canada pharmacy online my canadian pharmacies buy generic cialis canadian pharmacy india pharmacy
    canadian pharmacy for viagra cialis usa pharmacy northwestpharmacy.com generic pharmacy india
    india pharmacy canadian pharmacies without prescription generic viagra online pharmacy cialis canada pharmacy online viagra pharmacy
    pvwpjondugfp cialis-canadian pharmacy online pharmacy usa cialis-canadian pharmacy northwestpharmacy.com
    canadian online pharmacy best canadian online pharmacy reviews northwestpharmacy.com canada canadian pharcharmy

  4. zejrvvfzafkt

    canada pharmacies canadian pharmacies without prescription best canadian pharcharmy online viagra from canada pharmacy
    canadian online pharmacy for cialis canadian discount pharmacies my canadian pharcharmy online us pharmacy cialis
    buy cialis online canada pharmacy canada rx pharmacy viagra canadian pharmacy canadian cialis online pharmacy india pharmacy
    igeiovnsjfrg costco pharmacy online canadian pharcharmy online pharmacy without a prescription pharmacy rx one
    best canadian pharmacies shipping to usa canadian pharmacy viagra canadian pharmacy - cialis canada online pharmacy

  5. dissertation

    Beneficial data. Cheers. mba essay editing service https://essayextra.com custom writings service

  6. BrenoSuess
    BrenoSuess
    回复

    Wow many of excellent information.
    narrative essays for college writers help help writing thesis

  7. Homework Now.Com

    literature review write a paper online imortgage services

  8. xuehayyfzzjg

    cialis from usa pharmacy my canadian pharmacies canadian online pharmacy cialis canadian pharmacy online viagra
    canadian pharmacy cialis for daily use canadian pharmacy online canadapharmacyonline.com canada pharmacy for cialis
    cialis from canada pharmacy online pharmacies in usa canadian pharmacy - viagra generic cialis online pharmacy canadian pharcharmy online cialis
    gajvvzrccone canadian pharmacy viagra cialis mexico pharmacy cialis in canadian pharmacies cialis- canadian pharmacy
    brand viagra online canada pharmacy cialis usa pharmacy canadian pharmaceutical online canadian pharcharmy

  9. LouisBotze
    LouisBotze
    回复

    viagra online pharmacy cheap cialis online canada pharmacy best canadian online pharmacy reviews canada pharmacy online
    canadian pharmacy store canadian pharmacy online for viagra canada pharmacy cialis canadian viagra online pharmacy reviews
    canada rx pharmacy cialis in canadian pharmacies ed canadian pharmacy canadian-pharcharmy pharmacy rx one

  10. MarkDes
    MarkDes
    回复

    buy cheap viagra in usa omnicef cost 30 mg tadalafil chloroquine phosphate for sale uk vermox tablets australia ildenafil citrate zoloft 50mg cost

  11. EvaDes
    EvaDes
    回复

    viagra 20 mg

  12. SusanPaula
    SusanPaula
    回复

    us online casino accepts paypal
    online casinos that take echeck maquinas tragamonedas online roulette high limit jugar pocker best onlne casino directory
    online bingo games for money

  13. wgvxksgtybyp

    ed canadian pharmacy generic cialis online pharmacy legitimate online pharmacies india online pharmacies without prescription
    cialis at canadian pharmacies northwestern pharmacy canada legitimate online pharmacies india viagra from canada pharmacy
    cialis from canadian pharmacy cialis online canada pharmacy canadian online pharmacy viagra canadian pharcharmy online without prescription canadian pharmacy - cialis
    cbktopepdmgf canadian pharmacy.reviews northwestern pharmacy canada viagra canadian pharmacy my canadian pharcharmy online
    northwestpharmacy tadalafil india pharmacy cialis at canadian pharmacies universal pharmacy

  14. JackDes
    JackDes
    回复

    vardenafil online rhinocort 64 2.5 mg cialis generic cialis india pharmacy viagra cost tricor 140 mg omnicef for ear infection

  15. BodyBronup
    BodyBronup
    回复

    buy levitra in St Louis purchase levitra from Miami buy propecia online from New Orleans propecia online pharmacy in Boston name brand synthroid where to purchase synthroid in Baltimore

  16. jbzoglmrurub

    online pharmacies without prescription canadian pharmacy online for viagra canadian pharmacies generic ed medication canada drug pharmacy
    canadian online pharmacy viagra best canadian online pharmacy reviews canada pharmacies canada pharmacies online
    online canadian pharmacy cialis usa pharmacy canadian pharcharmy online viagra canada pharmacy cialis canadian rx pharmacy
    frbcrltaphzm cialis from canadian pharmacy viagra from canadian pharmacy cialis canadian pharmacy's cialis canadian pharmacies
    cialis- canadian pharmacy canadian pharmacy online canadian government approved pharmacies northwestpharmacy .com

  17. Victorgak
    Victorgak
    回复

    Ergo, they do extremely great to culprit cyst (that do). tadalafil online edsmrl it is undivided of the cheeky and acutely

  18. BodyBronup
    BodyBronup
    回复

    buying levitra online cheap us how much does levitra cost how to buy propecia in Minneapolis top 3 best places to buy propecia in UK best place to buy synthroid best price for synthroid in Nashville-Davidson

  19. ggxnixegvodi

    canadian viagra online pharmacy mexican pharmacy canadapharmacyonline.com viagra pharmacy
    cialis on canadian pharmacy canadian pharmacy viagra canada online pharmacy cialis from canadian pharmacy
    cheap viagra online canada pharmacy approved canadian online pharmacies canada online pharmacy viagra cialis online canada pharmacy viagra canada pharmacy
    aahbqzbizvzo canada drug pharmacy online canadian pharcharmy cialis canadian pharmacies canada pharmacy for viagra
    online pharmacy viagra tadalafil india pharmacy cialis mexico pharmacy viagra pharmacy

  20. JaneDes
    JaneDes
    回复

    buy suhagra 50 online

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