Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Pure VPN - Up to 27 Months
vgp
Updated:
Friday at 8:10 AM
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
May 30, 2026
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Education
Docker Sinhalen
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Zllion" data-source="post: 24021080" data-attributes="member: 568726"><p><span style="font-size: 18px">මම මේ දවස් වල Docker ඉගෙන ගන්නවා. මේ ගැන සිංහලෙන් ලියවුනු ලිපි අඩුයිනෙ . මේ තියෙන්නේ මට හම්බුනා ලිපියක්. මම එක මෙතන post කරනචා. කැමති </span></p><p><span style="font-size: 18px">අයට ඉගෙන ගන්න පුලුවන්නෙ. තව මේ වගේ ලිපි තියෙනවා නම් මෙතන දාන්න .</span></p><p></p><p></p><p></p><p><span style="font-size: 18px">සුභ දවසක් හැමෝටම. අද මම කතා කරන්න බලාපොරොත්තු වෙන්නේ Docker ගැන. මේ වෙනකොට software industry එකේ ගොඩක් ජනප්රිය technology එකක් තමයි Docker. අලුතෙන් industry එකට එන ඕනෙම කෙනෙකුට අවශ්ය වෙන platform එකක් කිව්වොත් හරියටම හරි. Docker ගැන articles, videos ගොඩක් තිබ්බත් සිංහලෙන් ලියවුන resources තියෙන්නේ හරිම අඩුවෙන්. ඒකයි මේ article එක සිංහලෙන් ලියන්න හිතුවේ. එහෙනං පටන්ගමු.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">මොකක්ද ඇත්තටම Docker කියන්නේ?</span></p><p><span style="font-size: 18px">Docker කියන්නේ දැනට ලෝකේ තියෙන ප්රධානම software container platform එක. එතකොට container එකක් කියන්නේ මොකක්ද?</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">Container එකක් කියන්නේ මොකක් හරි software එකක් run වෙන්න ඕනේ කරන codes, run-time, system tools, system libraries, settings වගේ හැමදේම එකතු කරපු image එකකට. උඩ diagram එකේ තියෙනවා වගේ අපේ project එකට ඕනේ කරන දේවල් එකතු කරලා අපිට වෙන වෙනම containers හදාගන්න පුළුවන්. ඒ වගේම මේ containers වල විශේෂත්වය තමයි මේවා ඔක්කොම isolated software environments වීම. ඒ කියන්නේ අපි එක container එකක use කරන දේවල් තවත් container එකකට visible නෑ.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">මොකක්ද Docker use කරන එකේ වාසිය.</span></p><p><span style="font-size: 18px">Docker වලින් විසඳන ප්රධානම ප්රශ්නේ තමයි “It worked on my machine”. ඔයාල මිට කලින් එක එක project කරලා ඇතිනේ. ඒවා කොහේ හරි production environment එකකට deploy කරන්න උත්සහ කරලා තියෙනවා නං මේ ප්රශ්නේ ගැන දන්නවා. ඔයාගේ machine එකේ හොදට run උන project එක server එකකට දැම්මට පස්සේ වැඩ කරන්නේ නෑ.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">මෙහෙම වෙන්න විවිධ හේතු තියෙන්න පුළුවන්. මොන හේතුව තිබුනත් Docker use කරොත් කිසිම කරදරයක් නැතුව ඔයාගේ project එක foreign environment එකක deploy කරන්න පුළුවන්. තියෙන්න ඕනේ එකම දේ Docker Engine එක විතරයි.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">උදාහරණයක් විදිහට අපි හිතමු ඔයාගේ project එක PHP, MySQL වලින් හදපු website එකක් කියලා. ඔයාට කරන්න තියෙන්නේ PHP image එකකුයි MySQL image එකකුයි docker hub එකෙන් pull කරගෙන ඔයාගේ code එකත් දාලා ඔයාගෙම Docker container එකක් හදාගන්න එක. ඊට පස්සේ ඔයාට ඒක run කරලා ඔයාගේ website එක up කරගන්න පුළුවන්. ඒ වගේම ඒක image එකක් විදිහට ආපහු docker hub එකට push කරලා ඔයාගේ production environment එකට pull කරගන්නත් පුළුවන්. එතකොට website එක කලින් විදිහටම එකෙත් run වෙනවා.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">මේ වගේ සරල දේවල් වගේම ගොඩක් සංකීර්ණ වැඩත් Docker වලින් ලේසියෙන්ම කරගන්න පුළුවන්.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">Docker vs. Virtual Machines?</span></p><p><span style="font-size: 18px">ඔයාල virtual machines ගැන අහලා තියෙනවා නං හිතෙන්න පුළුවන් මේකත් VM එකක් වගේ නේද කියල. ඇත්තටම නැහැ. Containers සහ VM අතර වෙනස් කම් තියෙනවා.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"><img src="http://i64.tinypic.com/1y4nzq.jpg" alt="" class="fr-fic fr-dii fr-draggable " style="" /></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">මේ diagram එක බැලුවොත් පැහැදිලි වෙනවා containers සහ VMs අතර වෙනස. VM වලදී අපිට containers වල නැති OS level process isolation එකක් ලබා ගන්න පුළුවන්. හැබැයි හැම VM එකක් එක්කම guest OS එකේ බරත් දරන්න සිද්ධ වෙනවා. VM එකක් up වෙන්න සාමන්යයෙන් විනාඩි කිහිපයක් ගියත් Docker container එකක් තත්පර ගානක් ඇතුලත up කරගන්න පුළුවන්. මේකෙන් කියන්නේ නෑ containers කියන්නේ VM වලට ආපු competition එකක් කියලා. අපේ අවශතාවය අනුව VMද containerද use කරන්නේ කියලා අපි තීරණය කරන්න ඕනේ.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">හරි. මන් හිතනවා දැන් ඔයාලට Docker ගැන basic idea එකක් තියෙනවා කියලා. මේක හොදටම තේරෙන්න නං Docker use කරලා බලන්නම වෙනවා. අදට මන් කියන්නන් කොහොමද Docker engine එක install කරගෙන example project එකක් run කරගන්නේ කියල. හැබැයි මම use කරන්නේ ubuntu. Windows සහ MacOS වල install කරන විදිහ ටිකක් වෙනස්. Official documentation එක බැලුවොත් ඒක එච්චර අමාරු වෙන්නේ නෑ. අනිත් Docker commands වෙනස් වෙන්නේ නෑ.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">Install Docker on Ubuntu 16.04</span></p><p><span style="font-size: 18px">මුලින්ම official Docker repository එකේ GPG key එක අපේ Ubuntu system එකට add කරගන්න ඕනේ. මේක නැත්තන් අපිට Docker download කරන්න බැරි වෙනවා. ඊළගට Docker repository එක add කරගන්න ඕනේ. ඒක add කරගත්තට පස්සේ අපේ package database එක update කරගත්තම Docker packages download කරන්න පුළුවන් වෙනවා. මන් මේ ටික එකටම දාල තියෙන්නේ ඔක්කොම එක පාර terminal එකට paste කරන්න පුළුවන් වෙන්න. (Ctrl + Shift + v)</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">[CODE]# Add the GPG key for the official Docker repository to the system:</span></p><p><span style="font-size: 18px">curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -</span></p><p><span style="font-size: 18px"># Add the Docker repository to APT sources:</span></p><p><span style="font-size: 18px">sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"</span></p><p><span style="font-size: 18px"># Update the package database with the Docker packages from the newly added repo:</span></p><p><span style="font-size: 18px">sudo apt-get update[/CODE]</span></p><p><span style="font-size: 18px">ඊළගට අපි check කරලා බලන්න ඕනේ Docker repository එක add උනාද කියල.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">[CODE]apt-cache policy docker-ce[/CODE]</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">මේ command එක ගැහුවම පහල තියෙන විදිහේ output එකක් එන්න ඕනේ. Version number එක වෙනස් වෙන්න පුළුවන්. හැබැයි candidate install location එක Docker repository වෙන්න ඕනේ. පහල Bold කරලා තියෙන line එක. මේක නැති උනොත් ඔයාට මුල ඉදලා ආපහු කරලා බලන්න වෙනවා.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">[CODE]Output of apt-cache policy docker-ce</span></p><p><span style="font-size: 18px">docker-ce:</span></p><p><span style="font-size: 18px"> Installed: (none)</span></p><p><span style="font-size: 18px"> Candidate: 17.03.1~ce-0~ubuntu-xenial</span></p><p><span style="font-size: 18px"> Version table:</span></p><p><span style="font-size: 18px"> 17.03.1~ce-0~ubuntu-xenial 500</span></p><p><span style="font-size: 18px"> [B]500 [url]https://download.docker.com/linux/ubuntu[/url] xenial/stable amd64 Packages[/B]</span></p><p><span style="font-size: 18px"> 17.03.0~ce-0~ubuntu-xenial 500</span></p><p><span style="font-size: 18px"> 500 [url]https://download.docker.com/linux/ubuntu[/url] xenial/stable amd64 Packages[/CODE]</span></p><p><span style="font-size: 18px">ඒ ටික හරි නං Docker install කරන්න පුළුවන් පහල command එකෙන්.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">[CODE]sudo apt-get install -y docker-ce[/CODE]</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">ඊළගට මේ command එකෙන් පහල තියෙනවා වගේ output එකක් එනවා නං වැඩේ හරි.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">[CODE]sudo systemctl status docker[/CODE]</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">[CODE]● docker.service - Docker Application Container Engine</span></p><p> <span style="font-size: 18px">Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)</span></p><p> <span style="font-size: 18px">Active: active (running) since සෙ 2017-09-09 15:45:27 +0530; 20h ago</span></p><p> <span style="font-size: 18px">Docs: [url]https://docs.docker.com[/url]</span></p><p> <span style="font-size: 18px">Main PID: 1159 (dockerd)</span></p><p> <span style="font-size: 18px">Tasks: 46</span></p><p> <span style="font-size: 18px">Memory: 72.0M</span></p><p> <span style="font-size: 18px">CPU: 5min 34.947s</span></p><p> <span style="font-size: 18px">CGroup: /system.slice/docker.service</span></p><p> <span style="font-size: 18px">├─1159 /usr/bin/dockerd -H fd://</span></p><p> <span style="font-size: 18px">├─1336 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 </span></p><p> <span style="font-size: 18px">├─1674 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 27018 -container-ip 172.17.0.2 -container</span></p><p> <span style="font-size: 18px">└─1716 docker-containerd-shim 932345d26cafca4da97dfaacd1fa7a6c4e7cb4cb9a71af19400a1a15682da156 /var/run/docker[/CODE]</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"><strong>Static site on Docker</strong></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">ඊළඟට අපි try කරමු example image එකක් run කරගන්න.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"><strong>docker run -d dockersamples/static-site</strong></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">මේ command එකෙන් වෙන්නේ docker demon එක static-site කියන image එක docker-hub එකෙන් pull කරගෙන container එකක් විදිහට ඔයාගේ machine එකේ run කරන එක.-d කිව්වේ detached mode එකෙන් run කරන්න කියලා. ඔය පහල command එක ගැහුවොත් බලාගන්න පුළුවන් අපි run කරපු container එකේ විස්තර.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">[CODE]docker ps[/CODE]</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"><img src="http://i64.tinypic.com/2nr12f9.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">දැන් එතකොට කොහොමද මේ site එක access කරන්නේ? මොකක්ද port එක? ඒවා කරන්න මේ පොඩි command එකෙන් බෑ. ඉස්සෙල්ලා අපි මේ හැදිච්ච container එක අයින් කරලා ඉමු.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">[CODE]docker stop ecstatic_nobel</span></p><p><span style="font-size: 18px">docker rm ecstatic_nobel</span></p><p><span style="font-size: 18px">[/CODE]</span></p><p><span style="font-size: 18px">ecstatic_nobel කියන්නේ docker demon මේ container එකට දුන්න random name එක. ඔයාගේ container name එක තමයි මෙතන එන්න ඕනේ. ඊළගට පහල command එක run කරන්න.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">[CODE]docker run --name static-site -e AUTHOR="Your Name" -d -P dockersamples/static-site[/CODE]</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">මේ command එකෙන් කලින් වගේම static-site container එකක් run වෙනවා. හැබැයි කලින්ට වඩා දේවල් ටිකක් වෙනවා.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">–name – කලින් පාර ලැබුන random name එක වෙනුවට අපි නමක් දෙනවා.</span></p><p><span style="font-size: 18px">-P – container එකේ ports ඔක්කොම host එකේ random ports වලට assign කරනවා.</span></p><p><span style="font-size: 18px">-e – මේ විදිහට තමයි container එකට environment variables pass කරන්නේ.</span></p><p><span style="font-size: 18px">AUTHOR – අපි pass කරන variable එක. මෙතන your name කියන තැන ඔයාගේ නම දාන්න.</span></p><p><span style="font-size: 18px">කලින් වතාවේ image එක download කරගත්තට මේ වතාවේ එහෙම උනේ නෑ නේද? image එකක් එක පාරක් download කරගත්තට පස්සේ ආපහු pull කරගන්න ඕනේ නෑ. Docker demon මුලින් අපේ machine එකේ image එක තියෙනවද කියලා බලලා තමයි pull කරගන්නේ.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">ඊළගට අපේ container එකට assign උන ports ටික බලාගන්න පුළුවන් පහල command එකෙන්.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">[CODE]docker port static-site[/CODE]</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"><img src="http://i68.tinypic.com/14btctf.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">අපේ static website එක බලාගන්න කරන්න තියෙන්නේ ඔයාගේ browser එකෙන් 80/tcp එකට අදාළ address එකට යන එක විතරයි.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"><img src="http://i64.tinypic.com/2lkyavb.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">Docker වලින් අපිට එක command එකකින් website එකක් run කරන්න පුළුවන්.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">මං හිතනවා දැන් ඔයාලට Docker ගැන idea එකක් එන්න ඇති කියල. ඉස්සරහට තවත් docker ගැන කතා කරන්න බලාපොරොත්තුවක් තියෙනවා. එහෙම post එකකින් නැවත හමු වෙමු. එතකං ජය!</span></p><p></p><p>source :<a href="https://everything1know.wordpress.com/2017/09/10/docker-%E0%B7%83%E0%B7%92%E0%B6%82%E0%B7%84%E0%B6%BD%E0%B7%99%E0%B6%B1%E0%B7%8A/" target="_blank">https://everything1know.wordpress.com/2017/09/10/docker-%E0%B7%83%E0%B7%92%E0%B6%82%E0%B7%84%E0%B6%BD%E0%B7%99%E0%B6%B1%E0%B7%8A/</a></p></blockquote><p></p>
[QUOTE="Zllion, post: 24021080, member: 568726"] [SIZE="5"]මම මේ දවස් වල Docker ඉගෙන ගන්නවා. මේ ගැන සිංහලෙන් ලියවුනු ලිපි අඩුයිනෙ . මේ තියෙන්නේ මට හම්බුනා ලිපියක්. මම එක මෙතන post කරනචා. කැමති අයට ඉගෙන ගන්න පුලුවන්නෙ. තව මේ වගේ ලිපි තියෙනවා නම් මෙතන දාන්න .[/SIZE] [SIZE="5"]සුභ දවසක් හැමෝටම. අද මම කතා කරන්න බලාපොරොත්තු වෙන්නේ Docker ගැන. මේ වෙනකොට software industry එකේ ගොඩක් ජනප්රිය technology එකක් තමයි Docker. අලුතෙන් industry එකට එන ඕනෙම කෙනෙකුට අවශ්ය වෙන platform එකක් කිව්වොත් හරියටම හරි. Docker ගැන articles, videos ගොඩක් තිබ්බත් සිංහලෙන් ලියවුන resources තියෙන්නේ හරිම අඩුවෙන්. ඒකයි මේ article එක සිංහලෙන් ලියන්න හිතුවේ. එහෙනං පටන්ගමු. මොකක්ද ඇත්තටම Docker කියන්නේ? Docker කියන්නේ දැනට ලෝකේ තියෙන ප්රධානම software container platform එක. එතකොට container එකක් කියන්නේ මොකක්ද? Container එකක් කියන්නේ මොකක් හරි software එකක් run වෙන්න ඕනේ කරන codes, run-time, system tools, system libraries, settings වගේ හැමදේම එකතු කරපු image එකකට. උඩ diagram එකේ තියෙනවා වගේ අපේ project එකට ඕනේ කරන දේවල් එකතු කරලා අපිට වෙන වෙනම containers හදාගන්න පුළුවන්. ඒ වගේම මේ containers වල විශේෂත්වය තමයි මේවා ඔක්කොම isolated software environments වීම. ඒ කියන්නේ අපි එක container එකක use කරන දේවල් තවත් container එකකට visible නෑ. මොකක්ද Docker use කරන එකේ වාසිය. Docker වලින් විසඳන ප්රධානම ප්රශ්නේ තමයි “It worked on my machine”. ඔයාල මිට කලින් එක එක project කරලා ඇතිනේ. ඒවා කොහේ හරි production environment එකකට deploy කරන්න උත්සහ කරලා තියෙනවා නං මේ ප්රශ්නේ ගැන දන්නවා. ඔයාගේ machine එකේ හොදට run උන project එක server එකකට දැම්මට පස්සේ වැඩ කරන්නේ නෑ. මෙහෙම වෙන්න විවිධ හේතු තියෙන්න පුළුවන්. මොන හේතුව තිබුනත් Docker use කරොත් කිසිම කරදරයක් නැතුව ඔයාගේ project එක foreign environment එකක deploy කරන්න පුළුවන්. තියෙන්න ඕනේ එකම දේ Docker Engine එක විතරයි. උදාහරණයක් විදිහට අපි හිතමු ඔයාගේ project එක PHP, MySQL වලින් හදපු website එකක් කියලා. ඔයාට කරන්න තියෙන්නේ PHP image එකකුයි MySQL image එකකුයි docker hub එකෙන් pull කරගෙන ඔයාගේ code එකත් දාලා ඔයාගෙම Docker container එකක් හදාගන්න එක. ඊට පස්සේ ඔයාට ඒක run කරලා ඔයාගේ website එක up කරගන්න පුළුවන්. ඒ වගේම ඒක image එකක් විදිහට ආපහු docker hub එකට push කරලා ඔයාගේ production environment එකට pull කරගන්නත් පුළුවන්. එතකොට website එක කලින් විදිහටම එකෙත් run වෙනවා. මේ වගේ සරල දේවල් වගේම ගොඩක් සංකීර්ණ වැඩත් Docker වලින් ලේසියෙන්ම කරගන්න පුළුවන්. Docker vs. Virtual Machines? ඔයාල virtual machines ගැන අහලා තියෙනවා නං හිතෙන්න පුළුවන් මේකත් VM එකක් වගේ නේද කියල. ඇත්තටම නැහැ. Containers සහ VM අතර වෙනස් කම් තියෙනවා. [IMG]http://i64.tinypic.com/1y4nzq.jpg[/IMG] මේ diagram එක බැලුවොත් පැහැදිලි වෙනවා containers සහ VMs අතර වෙනස. VM වලදී අපිට containers වල නැති OS level process isolation එකක් ලබා ගන්න පුළුවන්. හැබැයි හැම VM එකක් එක්කම guest OS එකේ බරත් දරන්න සිද්ධ වෙනවා. VM එකක් up වෙන්න සාමන්යයෙන් විනාඩි කිහිපයක් ගියත් Docker container එකක් තත්පර ගානක් ඇතුලත up කරගන්න පුළුවන්. මේකෙන් කියන්නේ නෑ containers කියන්නේ VM වලට ආපු competition එකක් කියලා. අපේ අවශතාවය අනුව VMද containerද use කරන්නේ කියලා අපි තීරණය කරන්න ඕනේ. හරි. මන් හිතනවා දැන් ඔයාලට Docker ගැන basic idea එකක් තියෙනවා කියලා. මේක හොදටම තේරෙන්න නං Docker use කරලා බලන්නම වෙනවා. අදට මන් කියන්නන් කොහොමද Docker engine එක install කරගෙන example project එකක් run කරගන්නේ කියල. හැබැයි මම use කරන්නේ ubuntu. Windows සහ MacOS වල install කරන විදිහ ටිකක් වෙනස්. Official documentation එක බැලුවොත් ඒක එච්චර අමාරු වෙන්නේ නෑ. අනිත් Docker commands වෙනස් වෙන්නේ නෑ. Install Docker on Ubuntu 16.04 මුලින්ම official Docker repository එකේ GPG key එක අපේ Ubuntu system එකට add කරගන්න ඕනේ. මේක නැත්තන් අපිට Docker download කරන්න බැරි වෙනවා. ඊළගට Docker repository එක add කරගන්න ඕනේ. ඒක add කරගත්තට පස්සේ අපේ package database එක update කරගත්තම Docker packages download කරන්න පුළුවන් වෙනවා. මන් මේ ටික එකටම දාල තියෙන්නේ ඔක්කොම එක පාර terminal එකට paste කරන්න පුළුවන් වෙන්න. (Ctrl + Shift + v) [CODE]# Add the GPG key for the official Docker repository to the system: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - # Add the Docker repository to APT sources: sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" # Update the package database with the Docker packages from the newly added repo: sudo apt-get update[/CODE] ඊළගට අපි check කරලා බලන්න ඕනේ Docker repository එක add උනාද කියල. [CODE]apt-cache policy docker-ce[/CODE] මේ command එක ගැහුවම පහල තියෙන විදිහේ output එකක් එන්න ඕනේ. Version number එක වෙනස් වෙන්න පුළුවන්. හැබැයි candidate install location එක Docker repository වෙන්න ඕනේ. පහල Bold කරලා තියෙන line එක. මේක නැති උනොත් ඔයාට මුල ඉදලා ආපහු කරලා බලන්න වෙනවා. [CODE]Output of apt-cache policy docker-ce docker-ce: Installed: (none) Candidate: 17.03.1~ce-0~ubuntu-xenial Version table: 17.03.1~ce-0~ubuntu-xenial 500 [B]500 [url]https://download.docker.com/linux/ubuntu[/url] xenial/stable amd64 Packages[/B] 17.03.0~ce-0~ubuntu-xenial 500 500 [url]https://download.docker.com/linux/ubuntu[/url] xenial/stable amd64 Packages[/CODE] ඒ ටික හරි නං Docker install කරන්න පුළුවන් පහල command එකෙන්. [CODE]sudo apt-get install -y docker-ce[/CODE] ඊළගට මේ command එකෙන් පහල තියෙනවා වගේ output එකක් එනවා නං වැඩේ හරි. [CODE]sudo systemctl status docker[/CODE] [CODE]● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since සෙ 2017-09-09 15:45:27 +0530; 20h ago Docs: [url]https://docs.docker.com[/url] Main PID: 1159 (dockerd) Tasks: 46 Memory: 72.0M CPU: 5min 34.947s CGroup: /system.slice/docker.service ├─1159 /usr/bin/dockerd -H fd:// ├─1336 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 ├─1674 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 27018 -container-ip 172.17.0.2 -container └─1716 docker-containerd-shim 932345d26cafca4da97dfaacd1fa7a6c4e7cb4cb9a71af19400a1a15682da156 /var/run/docker[/CODE] [B]Static site on Docker[/B] ඊළඟට අපි try කරමු example image එකක් run කරගන්න. [B]docker run -d dockersamples/static-site[/B] මේ command එකෙන් වෙන්නේ docker demon එක static-site කියන image එක docker-hub එකෙන් pull කරගෙන container එකක් විදිහට ඔයාගේ machine එකේ run කරන එක.-d කිව්වේ detached mode එකෙන් run කරන්න කියලා. ඔය පහල command එක ගැහුවොත් බලාගන්න පුළුවන් අපි run කරපු container එකේ විස්තර. [CODE]docker ps[/CODE] [IMG]http://i64.tinypic.com/2nr12f9.png[/IMG] දැන් එතකොට කොහොමද මේ site එක access කරන්නේ? මොකක්ද port එක? ඒවා කරන්න මේ පොඩි command එකෙන් බෑ. ඉස්සෙල්ලා අපි මේ හැදිච්ච container එක අයින් කරලා ඉමු. [CODE]docker stop ecstatic_nobel docker rm ecstatic_nobel [/CODE] ecstatic_nobel කියන්නේ docker demon මේ container එකට දුන්න random name එක. ඔයාගේ container name එක තමයි මෙතන එන්න ඕනේ. ඊළගට පහල command එක run කරන්න. [CODE]docker run --name static-site -e AUTHOR="Your Name" -d -P dockersamples/static-site[/CODE] මේ command එකෙන් කලින් වගේම static-site container එකක් run වෙනවා. හැබැයි කලින්ට වඩා දේවල් ටිකක් වෙනවා. –name – කලින් පාර ලැබුන random name එක වෙනුවට අපි නමක් දෙනවා. -P – container එකේ ports ඔක්කොම host එකේ random ports වලට assign කරනවා. -e – මේ විදිහට තමයි container එකට environment variables pass කරන්නේ. AUTHOR – අපි pass කරන variable එක. මෙතන your name කියන තැන ඔයාගේ නම දාන්න. කලින් වතාවේ image එක download කරගත්තට මේ වතාවේ එහෙම උනේ නෑ නේද? image එකක් එක පාරක් download කරගත්තට පස්සේ ආපහු pull කරගන්න ඕනේ නෑ. Docker demon මුලින් අපේ machine එකේ image එක තියෙනවද කියලා බලලා තමයි pull කරගන්නේ. ඊළගට අපේ container එකට assign උන ports ටික බලාගන්න පුළුවන් පහල command එකෙන්. [CODE]docker port static-site[/CODE] [IMG]http://i68.tinypic.com/14btctf.png[/IMG] අපේ static website එක බලාගන්න කරන්න තියෙන්නේ ඔයාගේ browser එකෙන් 80/tcp එකට අදාළ address එකට යන එක විතරයි. [IMG]http://i64.tinypic.com/2lkyavb.png[/IMG] Docker වලින් අපිට එක command එකකින් website එකක් run කරන්න පුළුවන්. මං හිතනවා දැන් ඔයාලට Docker ගැන idea එකක් එන්න ඇති කියල. ඉස්සරහට තවත් docker ගැන කතා කරන්න බලාපොරොත්තුවක් තියෙනවා. එහෙම post එකකින් නැවත හමු වෙමු. එතකං ජය![/SIZE] source :[URL="https://everything1know.wordpress.com/2017/09/10/docker-%E0%B7%83%E0%B7%92%E0%B6%82%E0%B7%84%E0%B6%BD%E0%B7%99%E0%B6%B1%E0%B7%8A/"]https://everything1know.wordpress.com/2017/09/10/docker-%E0%B7%83%E0%B7%92%E0%B6%82%E0%B7%84%E0%B6%BD%E0%B7%99%E0%B6%B1%E0%B7%8A/[/URL] [/QUOTE]
Insert quotes…
Verification
Dahaya deken beduwama keeyada?
Post reply
Top
Bottom