虫言虫语 虫言虫语

Docker基础使用(二)

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

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

支付宝打赏

文章二维码

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

发表新评论
已有 36222 条评论
  1. IvyDes
    IvyDes
    回复

    sildenafil 100mg canada pharmacy generic prednisolone 5mg can i order cialis online viagra 30 mg pharmacy prices levitra pill without prescription average cost of clomid prednisone 1 mg daily levitra canadian pharmacy cialis for sale mexico can you order viagra online in canada generic lyrica 2017 zithromax cost australia synthroid 88 mcg tablet tretinoin cream price uk

  2. JaneDes
    JaneDes
    回复

    40mg doxycycline

  3. MichaelJaf
    MichaelJaf
    回复

    Here are the great software programs that may help you with all your tasks: no viruses and hidden payments. By the way, only today all our software is FREE!internet explorer 7
    Dropbox for Windows 10
    hotspot shield vpn free proxy unblock sites
    google earth pro

  4. viagra shoppillrx

    where can i buy nizoral in canada
    where to buy real viagra
    cialis 5mg online bestellen roani Cloup

  5. IvyDes
    IvyDes
    回复

    cialis over the counter ivermectin 10 ml discount generic viagra buy aralen uk lipitor 40 mg tablet price chloroquine tablet price in india buy cheap levitra online doxycycline hydrochloride cost viagra 100mg clomid drug cost plaquenil tabs ventolin tablet 4mg 10 mg lexapro prednisolone drug generic viagra pills for sale

  6. ThomasFrets
    ThomasFrets
    回复

    buy prescription drugs without doctor https://canadarx24.com/
    non prescription ed drugs

  7. Online Lenders

    trusted payday loans personal loans with poor credit personal loans for debt consolidation check city payday loans emergency loan no credit check online loans no credit check advance cash payday loan

  8. EvaDes
    EvaDes
    回复

    buy viagra 500mg

  9. KimDes
    KimDes
    回复

    cialis generic 60 mg

  10. BAmiriumbum
    BAmiriumbum
    回复

    traitement herpes, pharmacie lafayette roanne pharmacie lafayette tassin . pharmacie de garde aujourd'hui besancon pharmacie de garde grasse https://www.hercampus.com/author/lyrica-pas-cher-en-france# , traitement grippe pharmacie xonrupt longemer traitement otite externe therapie cognitivo-comportementale brabant wallon http://bit.ly/39s6uS8# pharmacie capucins angers, pharmacie amiens dimanche therapie comportementale et cognitive beauvais . pharmacie pallanca beaulieu sur mer, pharmacie boulogne billancourt dimanche pharmacie albiol angers comprar Viagra comprar Viagra en Espana pharmacie de garde avignon numero traitement covid 19 .

  11. ThomasFrets
    ThomasFrets
    回复

    ed and diabetes https://canadarx24.com/
    generic ed pills

  12. JackDes
    JackDes
    回复

    hydroxychloroquine 800 mg generic cialis for sale in canada prednisolone tablets price

  13. beFugsassurb
    beFugsassurb
    回复

    https://cialistodo.com/ - price for tadalafil 10mg

  14. SamDes
    SamDes
    回复

    aralen order generic propecia tablets levitra capsules retin a 0.005 canadian mail order pharmacy best online pet pharmacy

  15. ThomasFrets
    ThomasFrets
    回复

    best ed medicine https://canadarx24.com/
    anti fungal pills without prescription

  16. daniellebn18
    daniellebn18
    回复

    Nude Sex Pics, Sexy Naked Women, Hot Girls Porn
    http://pornmenwomen.pinkspornstars.moesexy.com/?alivialong porn scenes free big tit anime lesbian porn elephant list porn site 3d vision redy porn download from paco porn

  17. SueDes
    SueDes
    回复

    tadalafil 3mg canadian pharmacy price for synthroid doxyciclin cheapest pharmacy to fill prescriptions with insurance prednisone 80 mg tablet amoxicillin 500 mg tablets prednisone 20mg cheap hydroxychloroquine sulfate 300 mg clomid mexico retin a gel cream

  18. ThomasFrets
    ThomasFrets
    回复

    mens ed https://canadarx24.com/
    erectyle disfunction

  19. generic cialis canada paypal

    buy zovirax cream australia
    viagra shipped from canada
    levitra 10 mg directions roani Cloup

  20. EugeneAgone
    EugeneAgone
    回复

    ######## FREE #########
    ULTIMATE РТНС COLLECTION
    NO PAY, PREMIUM or PAYLINK
    DOWNLOAD ALL СР FOR FREE
    =======================
    Description:-> gg.gg/lua7w
    =======================
    Webcams РТНС 1999-2021 FULL
    STICKAM, Skype, video_mail_ru
    Omegle, Vichatter, Interia_pl
    BlogTV, Online_ru, murclub_ru
    =======================
    Complete series LS, BD, YWM
    Sibirian Mouse, St. Peterburg
    Moscow, Liluplanet, Kids Box
    Fattman, Falkovideo, Bibigon
    Paradise Birds, GoldbergVideo
    Fantasia Models, Cat Goddess
    Valya and Irisa, Tropical Cuties
    Deadpixel, PZ-magazine, BabyJ
    Home Made Model (HMM)
    =======================
    Gay рthс collection: Luto
    Blue Orchid, PJK, KDV, RBV
    =======================
    Nudism: Naturism in Russia
    Helios Natura, Holy Nature
    Naturist Freedom, Eurovid
    =======================
    ALL studio collection: from
    Acrobatic Nymрhеts to Your
    Lоlitаs (more 100 studios)
    =======================
    Collection european, asian,
    latin and ebony girls (all
    the Internet video) > 4Tb
    =======================
    Rurikon Lоli library 171.4Gb
    manga, game, anime, 3D
    =======================
    This and much more here:
    or --> gg.gg/ntwfm
    or --> cpc.cx/tuu
    or --> xor.tw/4pt0y
    or --> v.ht/LEYc
    or --> cutt.us/lFqU4
    or --> gg.gg/ntwgr
    or --> v.ht/kIy2
    or --> apg.de/og
    or --> gg.gg/ntwhd
    ######## FREE #########
    -----------------
    -----------------xr1

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