服务部署-docker之间相互访问

2020年3月9日 02:06 by wst

docker使用

为什么使用Docker

原因有很多种,个人观点是:

使用Docker安装服务,比如MySQL。这样就不用修改系统的环境,省的和其他的软件相互影响。

 

服务部署

这里采用的方式是,先启动MySQL容器,然后再启动server 容器。

1. 启动MySQL容器:

拉取镜像:

docker pull mysql:5.7

构建容器:

docker run -itd -e MYSQL_ROOT_PASSWORD=123456 --name wst_mysql -p 3306:3306 mysql:5.7

 

2. 启动Server容器

编写Dockerfile:

FROM python:3.6.10

#定义时区参数
ENV TZ=Asia/Shanghai

# 设置编码
ENV LC_ALL C.UTF-8

#设置时区
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone

# 设置工作目录
WORKDIR /code

COPY . /code
RUN pip install -r /code/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

EXPOSE 8000

ENV FLASK_CONFIG development

CMD ["run.py"]

ENTRYPOINT  ["python"]

构建容器,进入Dockerfile所在目录后执行:

docker build -t abc:1.0 .

根据镜像生成容器:

docker run -itd --name bd -p 8000:8000 --link wst_mysql:db abc:1.0

注意这里的--link, 目的是使容器之间互联,即bd可以访问wst_mysql, 在bd中访问MySQL时需使用host:db

 

后续:

当然还有更好的方法,比如使用compose构建服务,等有时间再研究,欢迎留言!


Comments(126) Add Your Comment

Charlesnag
“I haven’t seen you in these parts,” the barkeep said, sidling during to where I sat. “Name’s Bao.” He stated it exuberantly, as if say of his exploits were shared by means of settlers about multifarious a ‚lan in Aeternum. He waved to a unimpassioned hogshead hard by us, and I returned his indication with a nod. He filled a eyeglasses and slid it to me across the stained red wood of the court prior to continuing. “As a betting chains, I’d be ready to wager a fair speck of enrich oneself you’re in Ebonscale Reach for the purpose more than the carouse and sights,” he said, eyes glancing from the sword sheathed on my in to the capitulate slung across my back. https://maps.google.no/url?q=https://renewworld.ru/otlichie-new-world-versii-deluxe-i-standart-edition/
Ggerst
atorvastatin without prescription <a href="https://lipiws.top/">buy atorvastatin generic</a> buy lipitor 40mg
Kqdmdf
purchase ciprofloxacin generic - <a href="https://cipropro.top/keflexcapsule/">keflex sale</a> augmentin 1000mg without prescription
Eurikz
cipro pills - <a href="https://metroagyl.top/">cheap ciprofloxacin</a> order augmentin 1000mg sale
Tqznwp
buy metronidazole 400mg without prescription - <a href="https://metroagyl.top/azithromycin/">purchase azithromycin pill</a> buy generic azithromycin online
Abtakm
ciplox usa - <a href="https://septrim.top/trimox/">trimox online</a> buy erythromycin 250mg pill
Ptfjrk
valacyclovir 1000mg us - <a href="https://gnantiviralp.com/vermox/">order nemazole pills</a> zovirax 800mg ca
Ztroxk
ivermectin 12mg pills - <a href="https://keflexin.top/sumycin/">buy sumycin generic</a> sumycin 500mg oral
Txveyc
metronidazole online order - <a href="https://metroagyl.top/oxytetracycline/">terramycin 250mg without prescription</a> buy azithromycin 500mg sale
Brzlju
ampicillin price <a href="https://ampiacil.top/doxycyclineantb/">monodox pills</a> buy amoxicillin medication
Rruolf
cost furosemide 100mg - <a href="https://antipathogenc.com/capoten/">capoten over the counter</a> buy captopril for sale
Bwfahr
buy metformin 1000mg pill - <a href="https://gnantiacidity.com/septra/">buy generic bactrim over the counter</a> buy cheap lincomycin
Jvkdub
zidovudine 300mg over the counter - <a href="https://canadiangnp.com/">metformin 500mg usa</a> zyloprim 100mg usa
Vfirwx
purchase clozaril online cheap - <a href="https://genonlinep.com/amaryl/">order glimepiride pills</a> buy cheap generic pepcid
Nrjlde
buy quetiapine 100mg generic - <a href="https://gnkantdepres.com/">buy quetiapine 50mg online</a> order eskalith for sale
Ubhymy
order clomipramine 50mg pill - <a href="https://antdeponline.com/tofranil/">order tofranil generic</a> order sinequan 75mg for sale
Vgnhfs
order hydroxyzine 25mg online - <a href="https://antdepls.com/pamelor/">pamelor pill</a> endep ca
Hwsuba
order augmentin 375mg for sale - <a href="https://atbioinfo.com/">buy augmentin 375mg sale</a> order cipro for sale
Wgkypa
amoxicillin pill - <a href="https://atbioxotc.com/ceftin/">ceftin tablet</a> cipro 500mg oral
Sjmuwp
oral cleocin - <a href="https://cadbiot.com/doxycycline/">purchase acticlate pills</a> cheap generic chloromycetin
Ktyhip
purchase zithromax online cheap - <a href="https://gncatbp.com/ctinidazole/">buy tinidazole 500mg generic</a> oral ciplox 500mg
Judzpv
ivermectin for human - <a href="https://antibpl.com/ascefaclor/">buy cefaclor pills for sale</a> order cefaclor 250mg online
Orlube
albuterol 2mg price - <a href="https://antxallergic.com/">ventolin canada</a> theophylline canada
Esaodw
buy medrol 4mg online - <a href="https://ntallegpl.com/getcetirizine/">buy cetirizine pills for sale</a> azelastine 10ml generic
Otxrvl
desloratadine oral - <a href="https://rxtallerg.com/beclomethasone/">beclamethasone tubes</a> best allergy for runny nose
Ttpqfm
glyburide 5mg usa - <a href="https://prodeprpl.com/">micronase 2.5mg price</a> forxiga 10 mg cost
Iftuvd
glucophage 500mg tablet - <a href="https://arxdepress.com/acarbose50/">buy generic acarbose 25mg</a> buy precose pills for sale
Ibbjsh
prandin 2mg us - <a href="https://depressinfo.com/jardiance25/">buy empagliflozin sale</a> order jardiance pills
Hvbrbo
order generic terbinafine 250mg - <a href="https://treatfungusx.com/xgrifulvinvs/">griseofulvin order online</a> grifulvin v without prescription
Yrplyz
buy semaglutide 14mg pill - <a href="https://infodeppl.com/">rybelsus for sale</a> desmopressin cheap
Xdonje
ketoconazole 200mg brand - <a href="https://antifungusrp.com/">buy nizoral 200mg without prescription</a> buy sporanox generic
Gaszbp
famvir without prescription - <a href="https://amvinherpes.com/">order famciclovir 250mg sale</a> valaciclovir ca
Mhnpay
digoxin 250 mg sale - <a href="https://blpressureok.com/furosemidediuret/">furosemide 100mg generic</a> buy furosemide pill diuretic
Kkzwto
microzide 25 mg brand - <a href="https://norvapril.com/amlodipine/">brand norvasc</a> order zebeta generic
Mldjho
buy lopressor sale - <a href="https://bloodpresspl.com/olmesartan/">brand olmesartan 10mg</a> adalat order online
Qxwpxt
purchase nitroglycerin online cheap - <a href="https://nitroproxl.com/clonidinechlorthalidone/">purchase combipres</a> buy diovan 80mg sale
Lkawai
simvastatin sit - <a href="https://canescholest.com/gemfibrozil/">lopid october</a> atorvastatin 10mg pills
Wpkwgg
rosuvastatin online favourite - <a href="https://antcholesterol.com/">rosuvastatin body</a> caduet online outline
Dczhzi
viagra professional online hungry - <a href="https://edsildps.com/cialisprofessional/">cialis professional village</a> levitra oral jelly online suggest
Penbrp
dapoxetine jaw - <a href="https://promedprili.com/aurogra/">aurogra against</a> cialis with dapoxetine nine
Ewluqi
cenforce online render - <a href="https://xcenforcem.com/zenegrasildenafil/">zenegra love</a> brand viagra online get
Odtsmy
brand cialis surface - <a href="https://probrandtad.com/penisole/">penisole various</a> penisole shore
Zabitg
cialis soft tabs grandfather - <a href="https://supervalip.com/cialisoraljelly/">cialis oral jelly pills harsh</a> viagra oral jelly swift
Fewteq
brand cialis famous - <a href="https://probrandtad.com/zhewitra/">zhewitra gleam</a> penisole gate
Fdndus
cialis soft tabs doubt - <a href="https://supervalip.com/tadarisepills/">tadarise pills buck</a> viagra oral jelly online eager
Xofzli
cenforce online serve - <a href="https://xcenforcem.com/silagrasildenafil/"></a> brand viagra absurd
Fbqhmn
priligy represent - <a href="https://promedprili.com/suhagra/">suhagra silk</a> cialis with dapoxetine corp
Ypsdxi
acne treatment time - <a href="https://placnemedx.com/">acne medication terrace</a> acne treatment mild
Vtqtyq
inhalers for asthma riddle - <a href="https://bsasthmaps.com/">inhalers for asthma bathroom</a> inhalers for asthma foolish
Zvfyhd
uti medication call - <a href="https://amenahealthp.com/">uti medication lend</a> treatment for uti style
Jioxjj
prostatitis treatment bunch - <a href="https://xprosttreat.com/">prostatitis treatment occasional</a> prostatitis treatment village
Ltomrb
valacyclovir online birthday - <a href="https://gnantiviralp.com/">valtrex web</a> valacyclovir online shin
Ouvkzu
claritin cost - <a href="https://clatadine.top/">claritin pills glitter</a> loratadine medication individual
Pafvud
priligy comfort - <a href="https://prilixgn.top/">dapoxetine supper</a> priligy rep
Yqyzaf
claritin pills invite - <a href="https://clatadine.top/">claritin focus</a> loratadine medication incident
Qobmaz
promethazine rib - <a href="https://prohnrg.com/">promethazine oh</a> promethazine axe
Gzrvnn
ascorbic acid grandfather - <a href="https://ascxacid.com/">ascorbic acid halt</a> ascorbic acid dean
Ebtalb
biaxin enjoy - <a href="https://gastropls.com/ranitidineonline/">zantac bold</a> cytotec pills wary
Fhjriw
fludrocortisone pills fierce - <a href="https://gastroplusp.com/propantoprazole/">protonix peter</a> prevacid blade
Jzelxq
buy dulcolax pills for sale - <a href="https://gastroinfop.com/liv52/">purchase liv52 pill</a> liv52 10mg cheap
Nsifmt
aciphex 10mg brand - <a href="https://gastrointesl.com/metoclopramide/">purchase maxolon online cheap</a> motilium 10mg without prescription
Hdewjn
buy cotrimoxazole - <a href="https://ketiracet.com/">levetiracetam 1000mg sale</a> tobra 10mg canada
Giitvf
hydroquinone ca - <a href="https://dupsteron.com/">buy dydrogesterone generic</a> where to buy dydrogesterone without a prescription
Phdqec
order dapagliflozin 10 mg pills - <a href="https://precarbos.com/">acarbose 25mg ca</a> order precose 25mg online
Wufxxi
buy fulvicin 250 mg generic - <a href="https://fulviseoful.com/">fulvicin 250mg sale</a> buy lopid online cheap
Vhyfbl
dimenhydrinate 50mg drug - <a href="https://bisacolax.com/">generic dramamine</a> buy generic actonel online
Uynbcj
buy enalapril paypal - <a href="https://doxapisin.com/">doxazosin 1mg over the counter</a> buy zovirax generic
Zxatda
order generic etodolac - <a href="https://cilosetal.com/">pletal usa</a> order pletal sale
Hlxkbc
order feldene 20 mg for sale - <a href="https://feldexicam.com/">generic feldene 20 mg</a> cost rivastigmine 6mg
Fjdrra
purchase hydroxyurea sale - <a href="https://hydroydrinfo.com/disulfiram/">disulfiram ca</a> methocarbamol sale
Qvwsdh
purchase divalproex online - <a href="https://adepamox.com/amiodarone/">buy amiodarone medication</a> topiramate oral
Sqygai
norpace pills - <a href="https://anorpica.com/lamivudine/">lamivudine where to buy</a> chlorpromazine 50 mg for sale
Nknswi
cyclophosphamide generic - <a href="https://cycloxalp.com/antivert/">buy antivert medication</a> buy trimetazidine no prescription
Xzlrcj
purchase aldactone for sale - <a href="https://aldantinep.com/naltrexone/">revia 50 mg pill</a> buy generic naltrexone online
Veynqs
flexeril 15mg oral - <a href="https://abflequine.com/primaquine/">buy primaquine</a> buy cheap vasotec
Nudjof
zofran drug - <a href="https://azofarininfo.com/selegiline/">purchase selegiline sale</a> how to buy requip
Jsgnpi
ascorbic acid generic - <a href="https://mdacidinfo.com/">purchase ascorbic acid generic</a> order compro for sale
Vznnkw
how to buy durex gel - <a href="https://xalaplinfo.com/">buy durex gel sale</a> cheap xalatan
Yuqnvk
brand minoxidil - <a href="https://mdacidinfo.com/dutasteride/">cheap dutas generic</a> proscar oral
Dtkmzl
order arava 10mg without prescription - <a href="https://infohealthybones.com/risedronate/">buy actonel 35 mg generic</a> cartidin generic
Nhiixr
verapamil order - <a href="https://infoheartdisea.com/atenolol/">where to buy tenoretic without a prescription</a> buy generic tenoretic
Ptpcrq
buy atenolol 100mg generic - <a href="https://heartmedinfox.com/carvedilol/">coreg 6.25mg for sale</a> buy generic carvedilol over the counter
Pbaxkx
cheap atorlip without prescription - <a href="https://infoxheartmed.com/nebivolol/">buy bystolic pill</a> bystolic over the counter
Thblyh
order gasex pill - <a href="https://herbalinfomez.com/ashwagandha/">purchase ashwagandha without prescription</a> buy diabecon
Gnexvv
purchase lasuna sale - <a href="https://infoherbalmz.com/himcolin/">buy himcolin sale</a> cheap generic himcolin
Odpnwh
noroxin brand - <a href="https://gmenshth.com/">buy norfloxacin without a prescription</a> confido online
Nlidyj
buy generic speman - <a href="https://spmensht.com/himplasia/">buy generic himplasia</a> buy generic finasteride over the counter
Kcdzbs
buy finax tablets - <a href="https://finmenura.com/">finax buy online</a> alfuzosin 10 mg pill
Yybvug
hytrin 5mg cheap - <a href="https://hymenmax.com/dapoxetine/">priligy 30mg usa</a> order priligy generic
Fwdkvx
cheap oxcarbazepine 300mg - <a href="https://trileoxine.com/pirfenidone/">order pirfenex pill</a> buy levoxyl tablets
Jlnqlq
buy duphalac sale - <a href="https://duphalinfo.com/betahistine/">buy cheap betahistine</a> buy betahistine 16mg without prescription
Pzcxuy
how to get cyclosporine without a prescription - <a href="https://asimusxate.com/gloperba/">buy gloperba generic</a> brand colchicine
Xiiqze
how to buy deflazacort - <a href="https://lazacort.com/brimonidine/">alphagan cost</a> buy generic alphagan
Gofdvf
order besivance without prescription - <a href="https://besifxcist.com/">order besifloxacin online</a> purchase sildamax generic
Ulciwa
benemid 500mg canada - <a href="https://bendoltol.com/carbamazepine/">carbamazepine 200mg us</a> carbamazepine 400mg pills
Ndzatw
neurontin usa - <a href="https://aneutrin.com/">gabapentin usa</a> sulfasalazine 500mg canada
Jqmeqk
colospa for sale - <a href="https://coloxia.com/">colospa 135mg brand</a> pletal 100mg price
Oinvuw
rumalaya order - <a href="https://rumaxtol.com/">rumalaya online</a> buy endep without prescription
Ewmwbr
order voltaren generic - <a href="https://dicloltarin.com/aspirin/">aspirin 75mg pill</a> buy aspirin 75mg sale
Ifnkvc
order diclofenac generic - <a href="https://vovetosa.com/tisosorbide/">buy isosorbide 20mg</a> nimotop order online
Xcpcxz
pyridostigmine 60mg brand - <a href="https://mestonsx.com/">order pyridostigmine</a> azathioprine 50mg usa
Vxqxjg
brand mobic 7.5mg - <a href="https://meloxiptan.com/">buy meloxicam 15mg sale</a> where can i buy toradol
Ydtoyi
buy baclofen paypal - <a href="https://baclion.com/nspiroxicam/">piroxicam online order</a> piroxicam tablet
Dlthif
artane order online - <a href="https://voltapll.com/diclofenacgel/">how to purchase diclofenac gel</a> purchase cheap diclofenac gel
Puivwx
buy generic periactin over the counter - <a href="https://periheptadn.com/aszanaflex/">purchase tizanidine generic</a> tizanidine online order
Ugzcqc
omnicef over the counter - <a href="https://omnixcin.com/aminocycline/"></a> buy cleocin for sale
Chtwsv
buy permethrin generic - <a href="https://actizacs.com/tretinoin/">order retin gel</a> buy tretinoin gel sale
Pbxmpj
prednisone 20mg canada - <a href="https://apreplson.com/prednisolone/">omnacortil 20mg oral</a> zovirax sale
Grmtwz
buy metronidazole 400mg without prescription - <a href="https://ametronles.com/">order flagyl 400mg generic</a> cenforce 50mg usa
Wgtaod
buy betnovate 20gm generic - <a href="https://betnoson.com/">order generic betnovate</a> monobenzone generic
Egghgw
cleocin drug - <a href="https://indometnp.com/">buy indomethacin 50mg pill</a> indomethacin capsule
Logpzf
clavulanate generic - <a href="https://baugipro.com/">augmentin for sale online</a> purchase levothyroxine generic
Erhydg
eurax for sale online - <a href="https://aeuracream.com/abactroban/">bactroban ointment cost</a> aczone where to buy
Pzzmyx
hyzaar uk - <a href="https://acephacrsa.com/">keflex 500mg drug</a> keflex 500mg sale
Fxolxw
order zyban 150 mg sale - <a href="https://bupropsl.com/">cheap zyban 150 mg</a> generic shuddha guggulu
Euapjs
purchase provigil pill - <a href="https://sleepagil.com/">buy generic modafinil for sale</a> meloset pills
Urvzpj
order prometrium sale - <a href="https://apromid.com/clomiphene/">order serophene online cheap</a> order fertomid generic
Pdilrx
capecitabine for sale online - <a href="https://xelocap.com/danocrine/">order danocrine 100mg online cheap</a> order danocrine 100mg for sale
Xcatvt
order aygestin 5 mg online - <a href="https://norethgep.com/bimatoprost/">order bimatoprost generic</a> yasmin price
Qapqzi
order fosamax pill - <a href="https://pilaxmax.com/medroxyprogesterone/">provera 10mg over the counter</a> order medroxyprogesterone 5mg generic
Tubyfe
buy generic cabergoline 0.25mg - <a href="https://adostilin.com/cabgolin/">purchase cabgolin online</a> brand alesse
Dwvlmu
estrace sale - <a href="https://festrolp.com/">estradiol drug</a> arimidex 1mg sale
Gysetv
シルデナフィル通販で買えますか - <a href="https://jpedpharm.com/">タダラフィル は通販での購</a> 正規品タダラフィル錠の正しい処方
Rjvmmu
プレドニン錠 5mg 強さ - <a href="https://jpaonlinep.com/jazithromycin/">アジスロマイシン処方</a> アジスロマイシン通販おすすめ
Vkewyb
eriacta hurried - <a href="https://eriagra.com/fforzestf/">forzest glad</a> forzest piece
Kxesmt
プレドニン通販 安全 - <a href="https://jpanfarap.com/">プレドニン錠 40 mg 強さ</a> アキュテイン通販 安全