虫言虫语 虫言虫语

Docker基础使用(二)

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

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

支付宝打赏

文章二维码

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

发表新评论
已有 6868 条评论
  1. Vernonjax
    Vernonjax
    回复

    Explosion at leicester in england (20 June 2016)A plane crashed in northern England carrying the King of England on Christmas Eve, killing his driver and killing his wife and eight-year-old son and leaving the passengers trapped and for several hours trapped beneath rubble.The incident happened on Christmas Eve and residents described seeing a massive explosion, while there was confusion about where the plane had crashed. The plane crashed into a nearby residential area, and residents in the nearby countryside could see people climbing out of the wreckage in desperate situations. Witnesses reported hearing a number of loud bangs and seeing black smoke and explosions above the buildings.The King was killed instantly in the explosion, according to Scotland's Daily Record.The King was on a three-day journey to Windsor on the north coast of England, and was due to fly from Liverpool to Southampton. He was staying in a two-story home just outside the town, with his wife, Anne of Cleves, and son, Prince George. Prince George will receive a state funeral service, scheduled for Monday evening, on Sunday (3 December), at Westminster Abbey where he will be attended by Queen Elizabeth and her children.He was an accomplished and popular leader, beloved by the people of the land and beloved by some in England, as he came to the throne at a young age after the death of his father in 1806. His love of his people was a source of inspiration, and his wife's passion for him became legendary. It was believed that when the plane's pilot, Martin Luther King, Jr., was killed in a traffic accident at the age of 36 on 20 May 1968, the King's death was not recorded in his will. King was succeeded in his throne on 1 December 1970.He left the Royal Air Force in 1963, having enlisted in the army at the age of 16 and served three years at Royal Hampshire College and four years at D-Day. He was knighted in 1965 by Prince Philip for services to the armed forces and the Armed Forces in World War II. King remained on leave from Royal Air Force until his death on 3 December last year.The British Prime Minister and the British Chancellor of the Exchequer, who have been at odds for several months over how to deal with the crash siteHe was born Prince Edward, of Northumberland, in May 1832.The young King served with distinction in Scotland and the Royal Air Force during World War II as part of the Royal Air Force's 2nd Bombardment Group, but only completed two operations. He was involved in combat operations in France in July 1944 and later was in action in France again in September the following year. His second mission in the war was against German troops, as he and Prince Philli
    온라인카지노
    바카라사이트Edward snowden applies to extend russia stayUS intelligence services may now continue monitoring German Chancellor Angela Merkel for signs of anti-US sentiment if Washington continues to support her anti-Russian stance on Russia, leaked diplomatic cables have revealed.After Obama met with Russian leader Vladimir Putin in a series of bilateral meetings, Russia's Foreign Minister Sergei Lavrov has been told that Washington will continue to monitor German President Frank-Walter Steinmeier for signs of "Russian sentiment."The cables describe a possible escalation of their ongoing secret monitoring."The United States continues to monitor German Chancellor Angela Merkel for signs of Russian sentiment," reads a cable from US ambassador to Nato, Jane Hartley, dated October 15, 2012. The memo further states that a meeting between President Putin and German Foreign Minister Frank-Walter Steinmeier is scheduled for September 29 to 30, so any anti-American sentiment there may have been previously.US intelligence agencies are now monitoring Angela Merkel's office and the offices of the German Bundestag in order to "assess her reaction to some of the statements by US officials during a meeting with Secretary of State Hillary] Clinton on the Middle East," read the second memo from US ambassador to Nato, Robert Work, dated November 17, 2012.Read moreThe "hostage" of the German Chancellor over the issue, the cables continue, has also led to the resignation of her foreign minister, Sigmar Gabriel, and the decision by the conservative Christian Democrats to quit power in Germany's Bundestag."Given a continuing focus by US intelligence on Chancellor Merkel over some of the statements by US officials regarding the situation in Syria, we will not rule out the possibility that US intelligence has come to the conclusion that a potential escalation in anti-US sentiment may be warranted if German sentiment remains weak," a further cable read.Both US and German intelligence agencies have conducted their own "assessments", the US cable explained, on the impact of the Merkel/US relationship on relations between the US and Germany. It concluded that any potential US-led operation in Syria could escalate tensions to the extent that it could "force Merkel to seek closer US-German cooperation on regional issues."The US embassy in Berlin had not responded to an RT request for comment on the leak of diplomatic cables from the US State Department in response to media reports claiming that the US intelligence services had gathered on the German chancellor for "several days."RT's RFE/RL spoke with an intelligence officer at the Bundesnachrichtendienst, Germany's domestic intelligence agency, and he confirmed US officials have been following Merkel."All the information is in circulation, no questions asked," the intelligence officer told RT. "The intelligence service

  2. canadian online pharmacies

    international pharmacies that ship to the usa
    http://canadiantrustmedpharmacy.com/
    [url=http://canadiantrustmedpharmacy.com/]mail order prescriptions from canada[/url]

  3. Hennaobete
    Hennaobete
    回复

    be0031 try it discounted viagrahttp://viagraaqwe.com/ viagra sale in u s ahttp://viagrauyr.com/

  4. http //www.reliablemedpharmacy.com/

    pharcharmy online no precipitation
    http://canadiantrustmedpharmacy.com/
    [url=http://canadiantrustmedpharmacy.com/]canadian pharmacy[/url]

  5. Amitsflormror

    hemp cbd hemp cbd cbd store hemp oil for pain

  6. Online Payday Loans

    [url=https://loansonlinenb.com/]how does a payday loan work[/url]

  7. Amitsflormror

    cbd online http://cbd-hemp.us.com/ - cbd tinctures cdb oils pure cbd oil hemp cbd oil

  8. smagmevagype
    smagmevagype
    回复

    best cbd oil [url=http://cbd-online.us.com/ ]cbd oil for dogs [/url] cbd hemp cbd pills cbd tinctures

  9. crapyragacoup

    cbd oil store http://cbdoilstore.us.com/ cbd pills cbd tinctures hemp oil for pain

  10. smagmevagype
    smagmevagype
    回复

    cbd medic [url=http://cbd-online.us.com/ ]buy cbd oil online [/url] cbd cream cbd oil benefits

  11. swimarumTauff

    cbd oil benefits [url=http://cbd-oils.us.com/ ]hemp cbd [/url] cbd oil benefits cbd online medterra cbd

  12. crapyragacoup

    cbd capsules cbd gummies cbd cbd near me [url=http://cbdoilstore.us.com/ ]cbd tinctures [/url]

  13. Svetaobete
    Svetaobete
    回复

    kamagra is4d97 cheap mail order is4d97 follow link is strips4d97 be blue diamond is4d97

  14. swimarumTauff

    cbd gummies [url=http://cbd-oils.us.com/ ]buy cbd oil [/url] hemp oil cbd oil

  15. canadian pharmacies online

    best online pharmacies canada
    http://canadianpharmaciesnorth.com/
    [url=http://canadianpharmaciesnorth.com/]approved canadian online pharmacies[/url]

  16. EvaDes
    EvaDes
    回复

    [url=http://bectrim.com/]cost of bactrim[/url]

  17. mail order prescriptions from canada

    online pharmacies canada
    http://canadianpharmaciesnorth.com/
    [url=http://canadianpharmaciesnorth.com/]canada pharmacies online prescriptions[/url]

  18. smagmevagype

    best cbd oil cbd cream hemp cbd

  19. Amitsflormror

    medterra cbd [url=http://cbd-hemp.us.com/ ]best cbd oil buy cbd oil [/url] hemp cbd oil cbd oil for pain cannabis oil

  20. crapyragacoup

    http://cbdoilstore.us.com/ cannabis oil http://cbdoilstore.us.com/ - cbd oil benefits buy cbd oil

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