SlideShare a Scribd company logo
1 of 5
How it done?
Create .NetCore simple webApiapplication
(https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/)
We will create 4 containers:
- NGINX– Load balancerforcoreApi’scontainers(https://hub.docker.com/_/nginx/)
- CoreApi1/CoreApi2– ContainerwithUbuntuoperatingsystem
(https://hub.docker.com/_/ubuntu/)
- Mysql – ContainerwithMySql database (https://hub.docker.com/_/mysql/)
Let’s GO!!!
2.1) Creatingdockernetwork
2.2) CreatingCoreApi1/CoreApi2conteiners:
CreatingDockerfile:
Thenwe needto create dockercontainersusingyourDockerfile:
FROM ubuntu:16.04 #Add Ubuntu image
COPY release/ /root/ #Copy files from your directory to Ubuntu directory
# Install required packages
RUN apt-get update && apt-get --yes install apt-utils && apt-get --yes install apt-
transport-https
RUN sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-
release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
RUN apt-get update && apt-get --yes install dotnet-dev-1.0.0-preview2.1-003177
ENTRYPOINT dotnet /root/netCore.dll #Set as starting point is .NEtCore project file
docker network create --subnet=172.18.0.0/16 mynet
dotnet publish "./../../../netCore/src/netCore" --output "./release" --configuration
release -r "ubuntu.16.04-x64" #locally compile project
docker build -t coreapi . #creating image ‘coreapi’ using your DockerFile
docker rm -f coreapi1 #remove container if exists
docker run --name coreapi1 #set container name
--restart unless-stopped
-p 5001:5000 #open port to reach from localhost:5001 your service in container
#port from your service configuration
--net mynet --ip 172.18.0.23 #static ip for container from ‘mynet’ network
-d coreapi #created container image
docker rm -f coreapi2
docker run --name coreapi2 --restart unless-stopped -p 5002:5000 --net mynet --ip
172.18.0.24 -d coreapi
2.3) CreatingMySql container
Filesstructure:
2.4) CreatingNGINXcontainer:
CreatingDockerfile:
Thenwe needto create dockercontainersusingyourDockerfile:
Creating‘nginx.conf’file toenable loadbalancing:
Filesstructure:
docker rm -f mysql
docker run --name=mysql -e MYSQL_ROOT_PASSWORD=admin -p 3306:3306 --net mynet --ip
172.18.0.20 -d mysql
FROM nginx #Add nginx image
COPY nginx.conf /etc/nginx/nginx.conf #copy nginx configuration file
docker rm -f serlb
docker build -t some-custom-nginx . #creating image ‘some-custom-nginx’ using your
DockerFile
docker run --name serlb --net mynet --ip 172.18.0.21 -p 80:80 -d some-custom-nginx
#port must be 80
events { }
http {
upstream webapi.local {
least_conn;
server 172.18.0.23:5000; #created image ip address
server 172.18.0.24:5000; #port from your service configuration
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
location / {
proxy_pass http://webapi.local; #name reaching from browser
}
}
}
Dockernetworkshouldlookafterall containerscreated:
Command: docker network inspect mynet

More Related Content

What's hot

2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOpsОмские ИТ-субботники
 
Docker 1.11 Meetup: Containerd and runc, by Arnaud Porterie and Michael Crosby
Docker 1.11 Meetup: Containerd and runc, by Arnaud Porterie and Michael Crosby Docker 1.11 Meetup: Containerd and runc, by Arnaud Porterie and Michael Crosby
Docker 1.11 Meetup: Containerd and runc, by Arnaud Porterie and Michael Crosby Michelle Antebi
 
Helpful pre commit hooks for Python and Django
Helpful pre commit hooks for Python and DjangoHelpful pre commit hooks for Python and Django
Helpful pre commit hooks for Python and Djangoroskakori
 
ABCing docker with environments - workshop
ABCing docker with environments - workshopABCing docker with environments - workshop
ABCing docker with environments - workshopVodqaBLR
 
runC: The little engine that could (run Docker containers) by Docker Captain ...
runC: The little engine that could (run Docker containers) by Docker Captain ...runC: The little engine that could (run Docker containers) by Docker Captain ...
runC: The little engine that could (run Docker containers) by Docker Captain ...Docker, Inc.
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructureSergiy Kukunin
 
What Have Syscalls Done for you Lately?
What Have Syscalls Done for you Lately?What Have Syscalls Done for you Lately?
What Have Syscalls Done for you Lately?Docker, Inc.
 
docker build with Ansible
docker build with Ansibledocker build with Ansible
docker build with AnsibleBas Meijer
 
AWS ECSを用いてbatchを動かそう
AWS ECSを用いてbatchを動かそうAWS ECSを用いてbatchを動かそう
AWS ECSを用いてbatchを動かそうtaisho2
 
Fun with containers: Use Ansible to build Docker images
Fun with containers: Use Ansible to build Docker imagesFun with containers: Use Ansible to build Docker images
Fun with containers: Use Ansible to build Docker imagesabadger1999
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to dockerBryan Yang
 
Seamless migration from nova network to neutron in e bay production
Seamless migration from nova network to neutron in e bay productionSeamless migration from nova network to neutron in e bay production
Seamless migration from nova network to neutron in e bay productionChengyuan Li
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortalsHenryk Konsek
 
Docker command
Docker commandDocker command
Docker commandEric Ahn
 
Object Storage with Gluster
Object Storage with GlusterObject Storage with Gluster
Object Storage with GlusterGluster.org
 
Container Monitoring with Sysdig
Container Monitoring with SysdigContainer Monitoring with Sysdig
Container Monitoring with SysdigSreenivas Makam
 

What's hot (20)

2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
 
Docker 1.11 Meetup: Containerd and runc, by Arnaud Porterie and Michael Crosby
Docker 1.11 Meetup: Containerd and runc, by Arnaud Porterie and Michael Crosby Docker 1.11 Meetup: Containerd and runc, by Arnaud Porterie and Michael Crosby
Docker 1.11 Meetup: Containerd and runc, by Arnaud Porterie and Michael Crosby
 
Helpful pre commit hooks for Python and Django
Helpful pre commit hooks for Python and DjangoHelpful pre commit hooks for Python and Django
Helpful pre commit hooks for Python and Django
 
Ansible intro
Ansible introAnsible intro
Ansible intro
 
ABCing docker with environments - workshop
ABCing docker with environments - workshopABCing docker with environments - workshop
ABCing docker with environments - workshop
 
runC: The little engine that could (run Docker containers) by Docker Captain ...
runC: The little engine that could (run Docker containers) by Docker Captain ...runC: The little engine that could (run Docker containers) by Docker Captain ...
runC: The little engine that could (run Docker containers) by Docker Captain ...
 
CoreOS Overview
CoreOS OverviewCoreOS Overview
CoreOS Overview
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructure
 
What Have Syscalls Done for you Lately?
What Have Syscalls Done for you Lately?What Have Syscalls Done for you Lately?
What Have Syscalls Done for you Lately?
 
docker build with Ansible
docker build with Ansibledocker build with Ansible
docker build with Ansible
 
AWS ECSを用いてbatchを動かそう
AWS ECSを用いてbatchを動かそうAWS ECSを用いてbatchを動かそう
AWS ECSを用いてbatchを動かそう
 
Fun with containers: Use Ansible to build Docker images
Fun with containers: Use Ansible to build Docker imagesFun with containers: Use Ansible to build Docker images
Fun with containers: Use Ansible to build Docker images
 
Docker^3
Docker^3Docker^3
Docker^3
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Seamless migration from nova network to neutron in e bay production
Seamless migration from nova network to neutron in e bay productionSeamless migration from nova network to neutron in e bay production
Seamless migration from nova network to neutron in e bay production
 
Docker n co
Docker n coDocker n co
Docker n co
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
 
Docker command
Docker commandDocker command
Docker command
 
Object Storage with Gluster
Object Storage with GlusterObject Storage with Gluster
Object Storage with Gluster
 
Container Monitoring with Sysdig
Container Monitoring with SysdigContainer Monitoring with Sysdig
Container Monitoring with Sysdig
 

Viewers also liked

MAB - DO 1 AO 99 (adaptado)
MAB - DO 1 AO 99 (adaptado)MAB - DO 1 AO 99 (adaptado)
MAB - DO 1 AO 99 (adaptado)Graciela Sousa
 
Area, manuel. políticas educativas tic en los sistemas escolares en
Area, manuel.  políticas educativas tic en los sistemas escolares enArea, manuel.  políticas educativas tic en los sistemas escolares en
Area, manuel. políticas educativas tic en los sistemas escolares enIngrid Arellano
 
Program gotong-royong perdana dan khidmat bantu pss
Program gotong-royong perdana dan khidmat bantu pssProgram gotong-royong perdana dan khidmat bantu pss
Program gotong-royong perdana dan khidmat bantu psstina12sara
 
JRV – Adapting cropping systems climate variability APEC Piura 2016
JRV – Adapting cropping systems climate variability APEC Piura 2016JRV – Adapting cropping systems climate variability APEC Piura 2016
JRV – Adapting cropping systems climate variability APEC Piura 2016Decision and Policy Analysis Program
 

Viewers also liked (6)

MAB - DO 1 AO 99 (adaptado)
MAB - DO 1 AO 99 (adaptado)MAB - DO 1 AO 99 (adaptado)
MAB - DO 1 AO 99 (adaptado)
 
Expo2 jair
Expo2 jairExpo2 jair
Expo2 jair
 
Semana 1
Semana 1Semana 1
Semana 1
 
Area, manuel. políticas educativas tic en los sistemas escolares en
Area, manuel.  políticas educativas tic en los sistemas escolares enArea, manuel.  políticas educativas tic en los sistemas escolares en
Area, manuel. políticas educativas tic en los sistemas escolares en
 
Program gotong-royong perdana dan khidmat bantu pss
Program gotong-royong perdana dan khidmat bantu pssProgram gotong-royong perdana dan khidmat bantu pss
Program gotong-royong perdana dan khidmat bantu pss
 
JRV – Adapting cropping systems climate variability APEC Piura 2016
JRV – Adapting cropping systems climate variability APEC Piura 2016JRV – Adapting cropping systems climate variability APEC Piura 2016
JRV – Adapting cropping systems climate variability APEC Piura 2016
 

Similar to DockerCoreNet

Docker orchestration v4
Docker orchestration v4Docker orchestration v4
Docker orchestration v4Hojin Kim
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)Soshi Nemoto
 
Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peekmsyukor
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Ben Hall
 
Dockerize Laravel Application
Dockerize Laravel ApplicationDockerize Laravel Application
Dockerize Laravel ApplicationAfrimadoni Dinata
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作Philip Zheng
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...Jérôme Petazzoni
 
Running .NET on Docker
Running .NET on DockerRunning .NET on Docker
Running .NET on DockerBen Hall
 
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With ContainersHanoi MagentoMeetup
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoHannes Hapke
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Ben Hall
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇Philip Zheng
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안양재동 코드랩
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionBen Hall
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 PresentationSreenivas Makam
 
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins Mando Stam
 
廣宣學堂: 容器進階實務 - Docker進深研究班
廣宣學堂: 容器進階實務 - Docker進深研究班廣宣學堂: 容器進階實務 - Docker進深研究班
廣宣學堂: 容器進階實務 - Docker進深研究班Paul Chao
 

Similar to DockerCoreNet (20)

Docker orchestration v4
Docker orchestration v4Docker orchestration v4
Docker orchestration v4
 
Docker orchestration
Docker orchestrationDocker orchestration
Docker orchestration
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 
Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peek
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
 
Dockerize Laravel Application
Dockerize Laravel ApplicationDockerize Laravel Application
Dockerize Laravel Application
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...
 
Running .NET on Docker
Running .NET on DockerRunning .NET on Docker
Running .NET on Docker
 
Docker
DockerDocker
Docker
 
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 Presentation
 
Simple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE LabSimple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE Lab
 
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
 
廣宣學堂: 容器進階實務 - Docker進深研究班
廣宣學堂: 容器進階實務 - Docker進深研究班廣宣學堂: 容器進階實務 - Docker進深研究班
廣宣學堂: 容器進階實務 - Docker進深研究班
 

DockerCoreNet

  • 1.
  • 2. How it done? Create .NetCore simple webApiapplication (https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/) We will create 4 containers: - NGINX– Load balancerforcoreApi’scontainers(https://hub.docker.com/_/nginx/) - CoreApi1/CoreApi2– ContainerwithUbuntuoperatingsystem (https://hub.docker.com/_/ubuntu/) - Mysql – ContainerwithMySql database (https://hub.docker.com/_/mysql/)
  • 3. Let’s GO!!! 2.1) Creatingdockernetwork 2.2) CreatingCoreApi1/CoreApi2conteiners: CreatingDockerfile: Thenwe needto create dockercontainersusingyourDockerfile: FROM ubuntu:16.04 #Add Ubuntu image COPY release/ /root/ #Copy files from your directory to Ubuntu directory # Install required packages RUN apt-get update && apt-get --yes install apt-utils && apt-get --yes install apt- transport-https RUN sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet- release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list' RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893 RUN apt-get update && apt-get --yes install dotnet-dev-1.0.0-preview2.1-003177 ENTRYPOINT dotnet /root/netCore.dll #Set as starting point is .NEtCore project file docker network create --subnet=172.18.0.0/16 mynet dotnet publish "./../../../netCore/src/netCore" --output "./release" --configuration release -r "ubuntu.16.04-x64" #locally compile project docker build -t coreapi . #creating image ‘coreapi’ using your DockerFile docker rm -f coreapi1 #remove container if exists docker run --name coreapi1 #set container name --restart unless-stopped -p 5001:5000 #open port to reach from localhost:5001 your service in container #port from your service configuration --net mynet --ip 172.18.0.23 #static ip for container from ‘mynet’ network -d coreapi #created container image docker rm -f coreapi2 docker run --name coreapi2 --restart unless-stopped -p 5002:5000 --net mynet --ip 172.18.0.24 -d coreapi
  • 4. 2.3) CreatingMySql container Filesstructure: 2.4) CreatingNGINXcontainer: CreatingDockerfile: Thenwe needto create dockercontainersusingyourDockerfile: Creating‘nginx.conf’file toenable loadbalancing: Filesstructure: docker rm -f mysql docker run --name=mysql -e MYSQL_ROOT_PASSWORD=admin -p 3306:3306 --net mynet --ip 172.18.0.20 -d mysql FROM nginx #Add nginx image COPY nginx.conf /etc/nginx/nginx.conf #copy nginx configuration file docker rm -f serlb docker build -t some-custom-nginx . #creating image ‘some-custom-nginx’ using your DockerFile docker run --name serlb --net mynet --ip 172.18.0.21 -p 80:80 -d some-custom-nginx #port must be 80 events { } http { upstream webapi.local { least_conn; server 172.18.0.23:5000; #created image ip address server 172.18.0.24:5000; #port from your service configuration } server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; location / { proxy_pass http://webapi.local; #name reaching from browser } } }