Docker notes #3 by emrebeyler

View this thread on steempeak.com
· @emrebeyler ·
$3.55
Docker notes #3
<center><img src="https://www.docker.com/sites/default/files/vertical.png"></center>
<center><sup><a href="https://www.docker.com/legal/brand-guidelines">The original Docker logo</a></center>

***

We continue to learn Docker. See the [first part](https://steemit.com/docker/@emrebeyler/docker-notes-2), [second part](https://steemit.com/docker/@emrebeyler/docker-notes-2) 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.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 46 others
properties (23)
post_id64,463,221
authoremrebeyler
permlinkdocker-notes-3
categorydocker
json_metadata{"format":"markdown","image":["https:\/\/www.docker.com\/sites\/default\/files\/vertical.png"],"tags":["docker","programming","devops","containers","busy"],"community":"busy","app":"busy\/2.5.6","users":["emrebeyler"],"links":["https:\/\/www.docker.com\/legal\/brand-guidelines","https:\/\/steemit.com\/docker\/@emrebeyler\/docker-notes-2","https:\/\/steemit.com\/docker\/@emrebeyler\/docker-notes-2"]}
created2018-10-18 07:55:54
last_update2018-10-18 07:55:54
depth0
children12
net_rshares3,023,336,517,164
last_payout2018-10-25 07:55:54
cashout_time1969-12-31 23:59:59
total_payout_value2.810 SBD
curator_payout_value0.735 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length2,473
author_reputation319,480,565,467,431
root_title"Docker notes #3"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (110)
@love-peace ·
great work and incredible my brother,i support your work,@emrebeyler
properties (22)
post_id64,463,328
authorlove-peace
permlinkre-emrebeyler-docker-notes-3-20181018t075800000z
categorydocker
json_metadata{"tags":["docker"],"users":["emrebeyler"],"app":"steemit\/0.1"}
created2018-10-18 07:58:03
last_update2018-10-18 07:58:03
depth1
children0
net_rshares0
last_payout2018-10-25 07:58:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length68
author_reputation16,468,978,654,828
root_title"Docker notes #3"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@fkoryp ·
good
properties (22)
post_id64,463,539
authorfkoryp
permlinkre-emrebeyler-docker-notes-3-20181018t080325219z
categorydocker
json_metadata{"tags":["docker"],"app":"steemit\/0.1"}
created2018-10-18 08:02:36
last_update2018-10-18 08:02:36
depth1
children0
net_rshares0
last_payout2018-10-25 08:02:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length4
author_reputation18,431,282,494
root_title"Docker notes #3"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@jejes ·
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.
![44065405_346364502805207_787515642797359104_n.png](https://cdn.steemitimages.com/DQmZjpN5epym1UA9Vkv2e3YeyWs43rjPhW6gt1w7AH5zzwa/44065405_346364502805207_787515642797359104_n.png)
https://steemit.com/upfundme/@wews/steemit-help-a-blue-baby-patient
👍  
properties (23)
post_id64,466,484
authorjejes
permlinkre-emrebeyler-docker-notes-3-20181018t092650582z
categorydocker
json_metadata{"image":["https:\/\/cdn.steemitimages.com\/DQmZjpN5epym1UA9Vkv2e3YeyWs43rjPhW6gt1w7AH5zzwa\/44065405_346364502805207_787515642797359104_n.png"],"links":["https:\/\/steemit.com\/upfundme\/@wews\/steemit-help-a-blue-baby-patient"],"tags":["docker"],"app":"steemit\/0.1"}
created2018-10-18 09:16:00
last_update2018-10-18 09:16:00
depth1
children0
net_rshares3,023,375,302
last_payout2018-10-25 09:16:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length464
author_reputation2,747,191,214,125
root_title"Docker notes #3"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@blockchainstudio · (edited)
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.
properties (22)
post_id64,504,727
authorblockchainstudio
permlinkre-emrebeyler-docker-notes-3-20181018t230312058z
categorydocker
json_metadata{"community":"busy","users":["emrebeyler","gomdory"],"links":["\/@emrebeyler","\/@gomdory"],"image":[],"app":"busy\/2.5.6","format":"markdown","tags":["docker"]}
created2018-10-18 23:03:12
last_update2018-10-18 23:05:12
depth1
children6
net_rshares0
last_payout2018-10-25 23:03:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length798
author_reputation187,643,417,195,608
root_title"Docker notes #3"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@emrebeyler ·
Hi there,

@gomdory looks cool. I guess there is also @dustsweeper doing the same thing.

> ps. I'm mainly using steem python library. Please somebody makes it up to date :( haha.

Did you try beem yet? It has a similar codebase with several enhancements and constant development updates. :)
properties (22)
post_id64,521,718
authoremrebeyler
permlinkre-blockchainstudio-re-emrebeyler-docker-notes-3-20181019t064301767z
categorydocker
json_metadata{"tags":["docker"],"users":["gomdory","dustsweeper"],"app":"steemit\/0.1"}
created2018-10-19 06:43:03
last_update2018-10-19 06:43:03
depth2
children5
net_rshares0
last_payout2018-10-26 06:43:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length291
author_reputation319,480,565,467,431
root_title"Docker notes #3"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@blockchainstudio ·
$0.02
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!
👍  ,
properties (23)
post_id64,527,137
authorblockchainstudio
permlinkre-emrebeyler-re-blockchainstudio-re-emrebeyler-docker-notes-3-20181019t091203049z
categorydocker
json_metadata{"links":["\/@dustsweeper","\/@gomdory"],"tags":["docker"],"community":"busy","format":"markdown","image":[],"app":"busy\/2.5.6","users":["dustsweeper.","gomdory"]}
created2018-10-19 09:12:06
last_update2018-10-19 09:12:06
depth3
children4
net_rshares19,557,547,775
last_payout2018-10-26 09:12:06
cashout_time1969-12-31 23:59:59
total_payout_value0.016 SBD
curator_payout_value0.004 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length350
author_reputation187,643,417,195,608
root_title"Docker notes #3"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (2)
@isnochys ·
Birthdaypost !BEER
👍  
properties (23)
post_id80,982,824
authorisnochys
permlinkre-docker-notes-3-20191018t060705z
categorydocker
json_metadata{"app":"beem\/0.20.23"}
created2019-10-18 06:07:12
last_update2019-10-18 06:07:12
depth1
children0
net_rshares0
last_payout2019-10-25 06:07:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length18
author_reputation36,963,899,244,133
root_title"Docker notes #3"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@beerlover ·
<div class='pull-right'>https://cdn.steemitimages.com/DQmaHThyECGhEx8tSfHZbiMFRNYjJ35K92cDgiJjkzBUaJo/One%20sip%20of%20BEER%20for%20you.gif<p><sup><a href='https://steem-engine.com/?p=market&t=BEER'>View or trade </a> <code>BEER</code>.</sup></p></div><center><br><br> <p> Hey @emrebeyler, here is a little bit of  <code>BEER</code> for you. Enjoy it!</p> </center>
properties (22)
post_id80,982,828
authorbeerlover
permlinkre-docker-notes-3-20191018t060726z
categorydocker
json_metadata{"app":"beem\/0.21.1"}
created2019-10-18 06:07:27
last_update2019-10-18 06:07:27
depth1
children0
net_rshares0
last_payout2019-10-25 06:07:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length365
author_reputation16,011,958,080,429
root_title"Docker notes #3"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000