We continue to learn Docker. See the first part, second part on the learning notes.
docker compose
A tool for running multi-container application. An application may need postgresql, redis, or any other 3rd party servers.
Building all of them inside a single container doesn't make any sense in practical.
Example: Running two containers; first one is the web app, second one is the mongodb instance. (filename convention: docker-compose.yml
.
services:
web:
image: "emrebeyler/my-web-app"
database:
image: "mongodb"
use docker compose up
to run the containers.
Port mapping
services:
web:
image: "emre/my-web-app"
ports:
- "80:5000"
Volume mapping
services:
database:
image: "mongodb"
volumes:
- /opt/data:/var/lib/mongodb
Stop or Remove containers
docker-compose stop
to stop containers.docker-compose down
to stop everything and remove the containers entirely.
Passing environment files to containers
services:
database:
image: "mongodb"
environment:
- MYSQL_ROOT_PASSWORD=password
It's also possible to set a environment file:
web:
env_file:
- web-variables.env
It's a good practice to share the configuration information via environment variables.
Placing dependencies on containers
It's not a good idea to fire up the web app before the database.
version: '3'
services:
web:
depends_on:
- db
db:
image: postgres
docker compose will start the postgres first, and web later since it. It follows the dependency order.
Networking between services
By default, every service can reach each other by their image names. No need to know which IP they operate on.
version: '3'
services:
web:
depends_on:
- db
db:
image: postgres
web service can reach the postgres server by using postgres://db:5432
as a connection string.
Please help this Blue Baby Patient, Laine Kharece by upvoting the link below. This is not a scam, we just need your support as part of steemit community. Thank you very much for reading and extending a little help.
https://steemit.com/upfundme/@wews/steemit-help-a-blue-baby-patient
great work and incredible my brother,i support your work,@emrebeyler
good
Hi @emrebeyler,
Thanks for your voting. Cause I know your id, I was a bit surpised :) Of course, I know you voted using a bot, but still it was quite interesting to me to see that too.
I also made a bot @gomdory (gomdory means cute bear in Korean), which rescues :) a comment that doesn't have the minimum voting (i.e., $0.02) to be paid out. It's being tested in kr community by subscription based, and people love it. Now I'm in academia, but I also worked at Facebook before. So Steemit is quite interesting to me. Sometimes I wish I also post in English to communicate with people more internationally. I'll probably make other dApp on steemit, at that time I may also open it to any user. Thanks again!
ps. I'm mainly using steem python library. Please somebody makes it up to date :( haha.
Hi there,
@gomdory looks cool. I guess there is also @dustsweeper doing the same thing.
Did you try beem yet? It has a similar codebase with several enhancements and constant development updates. :)
Sure I know @dustsweeper. @gomdory is free service. One interesting fact of kr community is people love commenting :) And I also believe some comments may be more valuable than main postings. Also comments are good for engagements.
I've tried beem for some new features. I kind of prefered more official one but maybe now I should move on :) Thanks!
Oh great, how can we opt-in for gomdory? ;)
Hi, unfortunately that's why it's for kr community only now. I'm not sure but free global service might be very difficult due to potential abusing. Thank you so much for your interest!
just in case, you may find this interesting: https://steemit.com/kr-steemit/@blockchainstudio/hangeul-tag
Don't need to read Korean. Just see tags :)
곰돌이가 @blockchainstudio님의 소중한 댓글에 $0.005을 보팅해서 $0.018을 살려드리고 가요. 곰돌이가 지금까지 총 991번 $14.675을 보팅해서 $12.808을 구했습니다. @gomdory 곰도뤼~
Birthdaypost !BEER
View or trade
BEER
.Hey @emrebeyler, here is a little bit of
BEER
for you. Enjoy it!