虫言虫语 虫言虫语

Docker基础使用(二)

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

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

支付宝打赏

文章二维码

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

发表新评论
已有 16865 条评论
  1. dwpzyjuaqyaw

    cialis from usa pharmacy cialis canadian pharmacy's canadian online pharmacy brand viagra online canada pharmacy
    canadian pharmacy for viagra cialis on canadian pharmacy canadian pharmacies without prescriptions viagra pharmacy online
    cheap cialis online canada pharmacy cialis canada online pharmacy canada drug pharmacy canadian pharmacy no prescription generic cialis online pharmacy
    vgzkhiutnjrg cialis in usa pharmacy cvs pharmacy online pharmacy usa canadian pharmacy cialis
    approved canadian online pharmacies www.northwestpharmacy.com viagra pharmacy online canadian pharmacy and viagra

  2. NickDes
    NickDes
    回复

    entocort capsules 3 mg viagra for sale in uk viagra for women pink pill buy viagra on line buy differin gel nz trazodone brand name in usa

  3. vlqszyfxxrif

    cialis canada online pharmacy buy viagra from canada pharmacy canadian online pharmacy cialis in canadian pharmacies
    canadian pharmacies viagra london pharmacy canada canadadrugpharmacy.com brand viagra online canada pharmacy
    northwestpharmacy.com generic cialis canada pharmacy online canadian pharmacy and viagra online pharmacy without prescription www.canadian pharmacy

  4. Victorgak
    Victorgak
    回复

    Lay turn is a quiet ciamedusa.com usa renal piece of the occurrence is and issue uncontrollably.

  5. SamDes
    SamDes
    回复

    buying zoloft in mexico buy caverta tablets vardenafil 20mg coupon how to buy generic levitra online

  6. Victorgak
    Victorgak
    回复

    Ujyzjr sneeda online cialis sildenafil vs tadalafil cialis price walgreens Jnhqri ugdkai

  7. LouisBotqo
    LouisBotqo
    回复

    cialis at canadian pharmacy canada online pharmacy www.canadianpharmacymeds.com best canadian online pharmacy reviews
    cheap cialis online canadian pharmacy canada pharmacies online viagra canadian online pharmacy for cialis viagra online canada pharmacy
    internet pharmacy canada pharmacy online viagra canadian pharmacies for viagra canadian pharmacies viagra pharmaceuticals from canada

  8. Writer Essay

    new mexico mortgage

  9. rsfqyvalfnka

    viagra india pharmacy northwestpharmacy.com canada canadian pharmacy cialis canadian online pharmacy for cialis
    canada online pharmacy canadian pharmacy online viagra canadian pharcharmy online viagra buy cialis online canada pharmacy
    canadian pharcharmy online reviews northwest canadian pharcharmy online cialis at canadian pharmacies canadian pharmacy without prescription costco pharmacy

  10. BodyBronup
    BodyBronup
    回复

    levitra online pharmacy in Switzerland cheap levitra in Norway best way to find cheap propecia in Albuquerque propecia online pharmacy in St Louis purchase synthroid from Oakland how to buy synthroid in Saudi Arabia

  11. aijjkyvjwfre

    cialis from canadian pharmacies cialis at canadian pharmacies cialis in canadian pharmacies canadian pharmacy without a prescription
    www.northwestpharmacy.com cialis pharmacy rx one cialis canada pharmacy cialis and pharmacy
    tadalafil india pharmacy universal pharmacy brand viagra online canada pharmacy approved canadian pharmacies online canada rx pharmacy
    pgsivbgmkvpa cialis in canadian pharmacies canada online pharmacies northwestpharmacy pharmacy rx one
    canadian pharcharmy's cialis online canada pharmacy canadian pharmacies shipping to usa canadian pharmaceuticals

  12. LouisBotqp
    LouisBotqp
    回复

    pharmacy rx one 60 mg cialis canada pharmacies online prescriptions list of canada online pharmacies generic cialis online pharmacy
    canadadrugpharmacy.com viagra canada online pharmacy cialis pharmacy buy viagra from canada pharmacy
    cialis online canadian pharmacy canada rx pharmacy canadian pharmacy online viagra overseas pharmacy canadian pharmacy online for viagra

  13. Fastest Payday Loan

    advance loans

  14. fggnltwoenjr

    canadian pharmacy and viagra canada pharmacy viagra canadian pharmacy without a prescription canadian online pharmacy for viagra
    northwestpharmacy viagra from canadian pharmacy www.onlinepharmaciescanada.com cialis canadian pharmacy
    canadian pharmacies viagra viagra pharmacy cialis canadian pharmacy canadianpharmacy.com canadian pharmacies viagra
    jwryzfmnrgth the canadian pharmacy canada pharmacy online viagra canadian pharmacy online viagra canada pharmacy for cialis
    canada pharmacy online viagra best canadian pharmacies shipping to usa canadian pharmacy cialis for daily use canada online pharmacy

  15. BodyBronup
    BodyBronup
    回复

    cheap levitra in Oakland cheap levitra in Cincinnati purchase propecia from Cleveland propecia overnight delivery where to buy synthroid in Milwaukee online how to buy synthroid in Charlotte

  16. rgbayAstew
    rgbayAstew
    回复

    side effects of cialis http://mencialed.com/ http://mencialed.com/ difference between viagra and cialis

  17. onaekpwqppvl

    northwestpharmacy.com canada canadian pharmacy cialis generic cialis online canadian pharmacy buy cialis from us pharmacy
    canadian pharmaceutical viagra canada pharmacy cialis canadian pharmacy best canadian pharmacies shipping to usa
    www.onlinepharmaciescanada.com viagra online canada pharmacy canadian pharmacy meds cialis canadian pharmacy canadian pharcharmy's
    hkorcicdggnd northwestpharmacy .com pharmacy rx one 60 mg cialis cialis from canada pharmacy pharmacy rx one 60 mg cialis
    canadian pharcharmy online without prescription cialis and pharmacy canadian pharmacy - cialis canadian pharmacies for viagra

  18. EvaDes
    EvaDes
    回复

    viagra tablet

  19. BodyBronup
    BodyBronup
    回复

    where to buy levitra in Netherlands purchase levitra from Cleveland purchase propecia from Greece cheap propecia in United States buy synthroid in Columbus synthroid for cheap

  20. LouisBotls
    LouisBotls
    回复

    northwest canadian pharcharmy online viagra canada online pharmacy canadian pharmacy viagra online canada pharmacies online
    canadian pharcharmy online cialis canada pharmacy viagra canadian pharcharmy online viagra canadian pharmacy no prescription
    canada pharmacies northwest canadian pharcharmy online canadian pharcharmy online viagra online canadian pharmacies mexican pharmacy

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