虫言虫语 虫言虫语

Docker基础使用(二)

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

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

支付宝打赏

文章二维码

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

发表新评论
已有 9319 条评论
  1. AlainnaKanarisobete

    cialis pharmacy rx viagrahttps://sildenonline.com/ - average price of sildenafil in usa 100mg
    sildenafil online prescriptioncan buy viagra china

  2. Markaobete
    Markaobete
    回复

    tienda en lnea de is53e7 forum ou acheter du is53e7 is canadien professionnel53e7 is tablets suppliers53e7

  3. Profferobete
    Profferobete
    回复

    enter site is sales uk6192 commande is via suisse6192

  4. EvaDes
    EvaDes
    回复

    cephalexin 500mg

  5. IvyDes
    IvyDes
    回复

    tadalafil tablets 20 mg doxycycline pills over the counter buy sildenafil no prescription wellbutrin generic propecia 5mg retin a over the counter tretinoin gel .05 valtrex generic over the counter paxil pill buy diflucan cephalexin 250mg capsules buy albuterol canadian pharmacy flomax buy prednisone azithromycin 500 lexapro prednisone neurontin tablets hydroxychloroquine 30 mg buy cheap doxycycline

  6. AlainnaKanarisobete

    viagra buy in austriahttps://sildenonline.com/ - sildenafil 20 mg prescription
    cheap sildenafil tablets 100mgbuy viagra online in dc

  7. AlainnaKanarisobete

    how students get the viagrahttps://sildenonline.com/ - how much is sildenafil 20 mg
    sildenafil 20 mg prescriptionlook there discount viagra uk

  8. Brand viagra professional

    Dlrvqa ivaqsf online casino games real money gambling casino online

  9. AlainnaKanarisobete

    viagra e nitrathttps://sildenonline.com/ - sildenafil tablets for sale
    sildenafil rx drugstore onlineviagras genericas en venezuela

  10. Carmenjes
    Carmenjes
    回复

    хронический цистит : Цистит https://bestsex.ru/uro_zabolev - инфекционный простатит Цистит

  11. AlainnaKanarisobete

    free viagra trial packhttps://sildenonline.com/ - anyone buy viagra online
    where to get sildenafil onlineviagra rx plus

  12. AlainnaKanarisobete

    can buy viagra chinahttps://sildenonline.com/ - sildenafil india paypal
    sildenafil 100mg couponusefull link womans viagra

  13. furnitureCaG
    furnitureCaG
    回复

    Top 3 small dining table - los angeles furniture online
    Our online store international company provides discount, write in an online chat.At the present time you are in best Our оnline store specialized firms in Bel air products for garden and home use and office modern lighting stores los angeles. Firm sells over 5000 products for a country house and houses or cafe-bar and piece of furniture.Natural tree, the that are used for the purpose products, has at its disposal reliability and wear resistance, delightful external data. All pieces of furniture processed particular compounds, because of which their surface does not absorb water, resistant to extremes temperature and influence of the sun. Wicker furniture excellent retains its functions even in cafe in open spaces. We catalog for you offered photographs furniture for dining room, hall, bedroom, children's room, as well as intended for storage of things - cabinets, chests of drawers and many others. We are waiting client visit our large online store, company in Miracle milethat appreciates all of its shopper. On portal our store you waiting colossal choice at cost. Our catalog contains price lists, Label data about types details potential kinds complete modules.Each item furniture produced directly from factory manufacturer. Decrease prices on Label achieved based on the absence of trade floor space, for rent which necessary pay and smallest staff workers. Minimum costs enable to establish affordable prices for every buyer for all groups goods. Want update your interior? Read carefully the news products home from modern collection, in her represented as products with colorful floral patterns and colors and products with chic texture finish metallic. Furniture Items for the garden is rightfully considered necessary attribute each modern housing. In the presented store online you can buy reliable furniture for garden and home in SANTA MONICAto you all furniture at desired time day.Prices, that provides online shop furniture items BEL AIR AND HOLMBY HILLS very visitor.As a rule small fee may cause certain questions regarding good quality products affordable modern contemporary furniture. The catalog which filled diverse items furniture composes only first-class factory products.

  14. AlainnaKanarisobete

    one pill of viagra to buyhttps://sildenonline.com/ - cost of sildenafil 20 mg
    sildenafil online prescriptionclick now online cheap viagra

  15. AlainnaKanarisobete

    viagra online pakistanhttps://sildenonline.com/ - sildenafil 20 mg tablet
    sildenafil online prescriptiongenericos viagra argentina

  16. Marcuscheax
    Marcuscheax
    回复

    Now I earn over € 13 261 a day
    I was released two weeks ago.
    With no other options, I thought my life was over.
    http://zdce.o0lf31xmet.xyz/d5
    Now I earn over € 1,261.42 a day.
    And for the first time and after only 2 months, my account is not overdrawn.
    http://xebld.movieallstar.xyz/d9Many have played and won via this PayPal word game and now is your chance.
    They limit the pay per search and limit pay to only ten searches per day. However, you can get paid for doing other tasks at Cash Crate, such as:
    Are you looking for the best online tutoring jobs from home?
    Your claim, including your name and address, will be sent to the person you say owes you money. They’ll get a chance to respond to your claim.
    You can use forums like FunAdvice to make some quick money online by giving advice on the topics you are interested in. You will get points for every valuable post and those points will be converted into dollars.

  17. AlainnaKanarisobete

    viagra masticabile italiahttps://sildenonline.com/ - buy sildenafil online no prescription
    sildenafil tablets for salepilule viagra pri

  18. AlainnaKanarisobete

    free coupons for viagrahttps://sildenonline.com/ - sildenafil over the counter nz
    sildenafil india paypalcost per dose viagra

  19. AlainnaKanarisobete

    viagra pfizer sur internethttps://sildenonline.com/ - sildenafil 100mg
    viagra come funzionaviagra apotheek online

  20. AlainnaKanarisobete

    50 mg viagra cialis levitrahttps://sildenonline.com/ - sildenafil prescription discount
    how to buy sildenafil online usacomo funciona o viagra

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