虫言虫语 虫言虫语

Docker基础使用(二)

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

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

支付宝打赏

文章二维码

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

发表新评论
已有 16856 条评论
  1. canadian trust pharmacy

    legitimate canadian mail order pharmacies
    http://canadianpharmacytrustmeds.com/
    canadian pharmacies online reviews

  2. tfhseyobsokj

    canadian pharmaceuticals cialis online pharmacy canadian pharmacy for viagra canadian pharmacy meds
    canadian pharmacy - cialis buy generic cialis canadian pharmacy pharmacy viagra cialis pharmacy rx one
    canadian pharmacy no prescription online pharmacy without prescription tadalafil india pharmacy highest rated canadian pharmacies canada pharmacy for cialis
    tpkiepbixxue the canada pharmacy online canadian pharmacies buy viagra online canada pharmacy approved canadian online pharmacies
    viagra from canadian pharmacy viagra india pharmacy viagra india pharmacy canadian online pharmacy for viagra

  3. https://aaaviag.com/

    viagra many pills
    healthy meds viagra
    safe place buy generic viagra roani Cloup

  4. Online Homework

    writing essay rubric

  5. https://aaaviag.com/

    viagra 50 y 100 mg
    viagra in japan
    cialis paypal approved sites roani Cloup

  6. vkhrbwktnbkm

    viagra from canadian pharmacy canada pharmacy for cialis www.canadianpharmacymeds.com canadian pharmacy online
    generic cialis online pharmacy pharmacy rx one canadian-pharcharmy cialis on canadian pharmacy
    approved canadian online pharmacies overseas pharmacy cialis canadian pharmacy onlinepharmaciescanada.com canadian pharcharmy online reviews
    zbotmzxjupfc cialis canadian pharmacy's cialis canada pharmacy canadian pharmacy and cialis my canadian pharmacy
    costco pharmacy canadian pharmacies without prescription cialis on canadian pharmacy canadian pharmacy and cialis

  7. Victorgak
    Victorgak
    回复

    australia And the searching petals whereas on the antecedent from cialis over the counter at walmart Xgabxr ovvfvw super cialis buying cialis online safely

  8. https://aaaviag.com/

    buy diclofenac sodium 75mg
    female viagra for sale
    oral lamisil online roani Cloup

  9. LouisBotga
    LouisBotga
    回复

    canadian pharcharmy online reviews canada pharmacy online cialis coupon for pharmacy canadian pharmacy and viagra
    northwestern pharmacy canada northwestpharmacy .com canadian cialis online pharmacy indian pharma
    online pharmacy without prescription canadian pharmacy reviews cheap viagra online canada pharmacy generic pharmacy india cialis canada pharmacy online

  10. BodyBronup
    BodyBronup
    回复

    how to buy levitra in Czech Republic where to buy levitra in Milwaukee propecia online pharmacy in Spain where is better to buy propecia buy synthroid in Cleveland synthroid by mail

  11. JackDes
    JackDes
    回复

    how much is viagra in usa 80 aspirin viagra gel caps kamagra oral jelly cape town arlen over the counter plaquenil price us toprol xl 25 allopurinol tablet 300mg

  12. KimDes
    KimDes
    回复

    entocort for ulcerative colitis

  13. https://aaaviag.com/

    efeitos cialis 5mg
    pfizer viagra
    what does a generic viagra look like roani Cloup

  14. sjyzrwa
    sjyzrwa
    回复

    private prescription viagra price http://canadian1pharmacy.com - buy viagra cialis generic cialis generique + test

  15. yahbehlefdpt

    canadian pharmacy viagra canadian pharmacy - cialis cialis canadian pharmacy's canadian pharmacy no prescription
    northwest canadian pharcharmy online canadian pharmacies without a prescription cheap cialis online canada pharmacy approved canadian pharmacies online
    canadian pharmacies viagra cialis canadian pharmacy's online pharmacy viagra canadian pharcharmy online without prescription cialis canada online pharmacy
    cftqdokefpii london pharmacy canada canadian pharmacy for viagra cheap viagra online canada pharmacy canadian pharmacy cialis for daily use
    canadian pharmacy cialis 20mg www.onlinepharmaciescanada.com canadian pharmacies generic ed medication canadian pharmacy without prescription

  16. https://aaaviag.com/

    can i buy lexapro in mexico
    names female viagra
    vardenafil hydrochloride 20 mg roani Cloup

  17. MiaDes
    MiaDes
    回复

    where can i buy viagra over the counter in canada generic viagra online europe quineprox kratom chloroquine generic 39 mg cymbalta sildenafil australia buy

  18. BodyBronup
    BodyBronup
    回复

    levitra generic how to buy levitra in Cleveland top 10 best places to buy propecia in Luxembourg buy propecia in Long Beach cheap synthroid in New Orleans cheap synthroid in United Kingdom

  19. LouisBotox
    LouisBotox
    回复

    my canadian pharcharmy online canadian pharmacy cialis 20mg generic viagra online pharmacy legitimate online pharmacies india
    online pharmacy usa viagra online canada pharmacy canadian pharmacies without a prescription usa pharmacy online
    generic cialis canada pharmacy viagra pharmacy online canadian pharmacies generic drugs online canadian pharmacy with viagra generic cialis canada pharmacy online

  20. SueDes
    SueDes
    回复

    kamagra 200mg uk effexor ir cialis 60mg online buy cialis over the counter canada buy omnicef online buy diovan 160 mg can i buy viagra in europe otc cialis canada kamagra oral jelly next day delivery suhagra 100 pill

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