SlideShare a Scribd company logo
Docker Basics
Panuwat Boonrod (New)
- O L D S C H O O L D E V E L O P M E N T
- I N T R O D U C T I O N T O C O N T A I N E R
- W H Y W E N E E D C O N T A I N E R ?
- D O C K E R V S V I R T U A L M A C H I N E
- D O C K E R O V E R V I E W
- D O C K E R B U I L D
- D O C K E R R E G I S T R Y
- D O C K E R R U N
A G E N D A
O L D S C H O O L D E P L O Y M E N T
D E V E L O P E R O P E R A T O R
I sent a copy into
SMTP server
already
Got it!, I will
deploy soon.
Deployment day
O L D S C H O O L D E P L O Y M E N T
D E V E L O P E R O P E R A T O R
…. ….
Deploying….
Deployment day
O L D S C H O O L D E P L O Y M E N T
D E V E L O P E R O P E R A T O R
Yepp!!
Let see the
results
Deployment day
Deploy
completed !!
O L D S C H O O L D E P L O Y M E N T
D E V E L O P E R O P E R A T O R
Its work on my
machine !!
It’s crash !!
Deployment day
Container
T H E M O S T
P O P U L A R
C O N T A I N E R
M A N A G E R .
D O C K E R
Container vs Virtual Machine
Docker overview
Dockerfile Image Registry Container
Push image Pull image & run
Build
Ship Run
Docker build
What is Dockerfile ?
- Dockerfile describes step by step instructions of all the commands you need to run to assemble a
Docker Image.
“Docker build” command
“docker build” command processes Dockerfile generating a Docker Image in your Local Image Cache, which you can then
start-up using the “docker run” command, or push to a permanent Image Repository
$ docker build -t <IMAGE_NAME> .
Docker Registry
What is Docker Registry ?
- A registry is a storage and content delivery system, holding named Docker images, available in
different tagged versions. eg. Docker Hub, Quay.io, GCR, ECR
“Docker Push” command
“docker push” command helps you to push Docker images to the Docker registry.
$ docker push [IMAGE:TAG]
Docker Run
“Docker Run” command
-“docker run” command helps you to run Docker image as a container instance.
General Command Form
The basic “docker run” command takes this form:
$ docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
$ docker run -it ubuntu
Docker demo
Dockerfile Image
Build
Docker push(demo)
Image Registry Container
Push image Pull image & run
Ship Run
1.Installation
⁃ Windows -> https://docs.docker.com/docker-for-windows/install/
⁃ mac0S -> https://docs.docker.com/docker-for-mac/install/
⁃ Linux Ubuntu
$ sudo apt update
$ sudo apt install docker.io
$ sudo docker run hello-word
Terminal/ iTerm
1. Register docker hub
2. login docker on terminal
- $docker login
2.Create project
.
├── Dockerfile
└── main.py
0 directories, 2 files
Normally you should have this folder architecture:
3. Edit python file
#!/usr/bin/env python3
print(“My first container with python”)
You can add the following code to the ‘main.py’ file:
4. Edit dockerfile
# A dockerfile must always start by importing the base image.
# We use the keyword 'FROM' to do that.
# In our example, we want import the python image.
# So we write 'python' for the image name and 'latest' for the version.
FROM python:latest
# In order to launch our python code, we must import it into our image.
# We use the keyword 'COPY' to do that.
# The first parameter 'main.py' is the name of the file on the host.
# The second parameter '/' is the path where to put the file on the image.
# Here we put the file at the image root folder.
COPY main.py /
# We need to define the command to launch when we are going to run the image.
# We use the keyword 'CMD' to do that.
# The following command will execute "python ./main.py".
CMD [ "python", "./main.py" ]
5. Create docker image
$ docker build -t python-test
6. Run docker image
$ docker run python-test
The ’-t’ option allows you to define the name of your image. In our case we have chosen ’python-test’ but you can put what you want.
There you go, that’s it. You should normally see “My first container with python” displayed in your terminal.
Nginx demo
$ docker pull nginx:stable
Run nginx image
$ docker run --name nginx-webserver1 -v /var/www/html:/usr/share/nginx/html:ro -p 8080:80 -d nginx:stable
Results
- open browser
- Type localhost:8080
<html><title> Docker </title>
<body> Docker nginx </body>
</html>
/var/www/html/index.html
Useful commands for Docker
• List your images.
$ docker image ls
• Delete a specific image.
$ docker image rm [image name]
• Delete all existing images.
$ docker image rm $(docker images -a -q)
• List all existing containers (running and not running).
$ docker ps -a
Delete specific only container (if only stopped)
$ docker rm [container name]
Delete all containers (only stopped)
$ docker rmi [image name ]
Search images
$ docker search [image name]
Display logs of a container
$ docker logs [container name]
Documents
- https://docs.docker.com
Docker online simulator
- https://www.katacoda.com/courses/docker/deploying-first-container
Thank you.

More Related Content

What's hot

Docker Compose: Docker Configuration for the Real World
Docker Compose:  Docker Configuration for the Real WorldDocker Compose:  Docker Configuration for the Real World
Docker Compose: Docker Configuration for the Real World
Will Hall
 
Developer workflow with docker
Developer workflow with dockerDeveloper workflow with docker
Developer workflow with docker
Wyn B. Van Devanter
 
Intro To Docker
Intro To DockerIntro To Docker
Intro To Docker
Jessica Lucci
 
Docker on Google App Engine
Docker on Google App EngineDocker on Google App Engine
Docker on Google App EngineDocker, Inc.
 
Learn docker in 90 minutes
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutes
Larry Cai
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
James Turnbull
 
Docker navjot kaur
Docker navjot kaurDocker navjot kaur
Docker navjot kaur
Navjot Kaur
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
Anvay Patil
 
Docker - fundamental
Docker  - fundamentalDocker  - fundamental
Docker - fundamental
Chen-Tien Tsai
 
Dockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at RackspaceDockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at RackspacedotCloud
 
Docker Oxford launch - Introduction to Docker
Docker Oxford launch - Introduction to DockerDocker Oxford launch - Introduction to Docker
Docker Oxford launch - Introduction to Docker
jonatanblue
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101
Bill Maxwell
 
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
Puppet
 
docker compose
docker composedocker compose
docker compose
Alex Fernandez
 
Docker compose and swarm
Docker compose and swarmDocker compose and swarm
Docker compose and swarm
Tanmay Mehra
 
Docker 활용법: dumpdocker
Docker 활용법: dumpdockerDocker 활용법: dumpdocker
Docker 활용법: dumpdocker
Jaehwa Park
 
First steps to docker
First steps to dockerFirst steps to docker
First steps to docker
Guilhem Marty
 
Introduction to docker and docker compose
Introduction to docker and docker composeIntroduction to docker and docker compose
Introduction to docker and docker compose
Lalatendu Mohanty
 
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Virtual Meetup Docker + Arm: Building Multi-arch Apps with BuildxVirtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Docker, Inc.
 
Docker Container-Introduction and Features
Docker Container-Introduction and FeaturesDocker Container-Introduction and Features
Docker Container-Introduction and Features
Ashnikbiz
 

What's hot (20)

Docker Compose: Docker Configuration for the Real World
Docker Compose:  Docker Configuration for the Real WorldDocker Compose:  Docker Configuration for the Real World
Docker Compose: Docker Configuration for the Real World
 
Developer workflow with docker
Developer workflow with dockerDeveloper workflow with docker
Developer workflow with docker
 
Intro To Docker
Intro To DockerIntro To Docker
Intro To Docker
 
Docker on Google App Engine
Docker on Google App EngineDocker on Google App Engine
Docker on Google App Engine
 
Learn docker in 90 minutes
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutes
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Docker navjot kaur
Docker navjot kaurDocker navjot kaur
Docker navjot kaur
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
 
Docker - fundamental
Docker  - fundamentalDocker  - fundamental
Docker - fundamental
 
Dockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at RackspaceDockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at Rackspace
 
Docker Oxford launch - Introduction to Docker
Docker Oxford launch - Introduction to DockerDocker Oxford launch - Introduction to Docker
Docker Oxford launch - Introduction to Docker
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101
 
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
 
docker compose
docker composedocker compose
docker compose
 
Docker compose and swarm
Docker compose and swarmDocker compose and swarm
Docker compose and swarm
 
Docker 활용법: dumpdocker
Docker 활용법: dumpdockerDocker 활용법: dumpdocker
Docker 활용법: dumpdocker
 
First steps to docker
First steps to dockerFirst steps to docker
First steps to docker
 
Introduction to docker and docker compose
Introduction to docker and docker composeIntroduction to docker and docker compose
Introduction to docker and docker compose
 
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Virtual Meetup Docker + Arm: Building Multi-arch Apps with BuildxVirtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
 
Docker Container-Introduction and Features
Docker Container-Introduction and FeaturesDocker Container-Introduction and Features
Docker Container-Introduction and Features
 

Similar to Docker basics 30_01_21.ppx

Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
CodeOps Technologies LLP
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
Alexandre Salomé
 
Getting Started with Docker
Getting Started with Docker Getting Started with Docker
Getting Started with Docker
Anup Segu
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdf
OKLABS
 
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth RushgroveThe Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
Docker, Inc.
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
Alper Kanat
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
Henryk Konsek
 
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
Ganesh Samarthyam
 
Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers
Will Hall
 
A Hands-on Introduction to Docker
A Hands-on Introduction to DockerA Hands-on Introduction to Docker
A Hands-on Introduction to Docker
CodeOps Technologies LLP
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoHannes Hapke
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
Guido Schmutz
 
Primi passi con Docker - ItalianCoders - 12-01-2021
Primi passi con Docker - ItalianCoders - 12-01-2021Primi passi con Docker - ItalianCoders - 12-01-2021
Primi passi con Docker - ItalianCoders - 12-01-2021
Alessandro Mignogna
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
Runcy Oommen
 
Introduction to Docker - Learning containerization XP conference 2016
Introduction to Docker - Learning containerization  XP conference 2016Introduction to Docker - Learning containerization  XP conference 2016
Introduction to Docker - Learning containerization XP conference 2016
XP Conference India
 
Docker & FieldAware
Docker & FieldAwareDocker & FieldAware
Docker & FieldAwareJakub Jarosz
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
Binary Studio
 
Learning Docker with Thomas
Learning Docker with ThomasLearning Docker with Thomas
Learning Docker with Thomas
Thomas Tong, FRM, PMP
 
Docker 101
Docker 101Docker 101
Docker 101
schmidtbt
 

Similar to Docker basics 30_01_21.ppx (20)

Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
 
Getting Started with Docker
Getting Started with Docker Getting Started with Docker
Getting Started with Docker
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdf
 
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth RushgroveThe Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
 
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers
 
A Hands-on Introduction to Docker
A Hands-on Introduction to DockerA Hands-on Introduction to Docker
A Hands-on Introduction to Docker
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
 
Primi passi con Docker - ItalianCoders - 12-01-2021
Primi passi con Docker - ItalianCoders - 12-01-2021Primi passi con Docker - ItalianCoders - 12-01-2021
Primi passi con Docker - ItalianCoders - 12-01-2021
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
 
Introduction to Docker - Learning containerization XP conference 2016
Introduction to Docker - Learning containerization  XP conference 2016Introduction to Docker - Learning containerization  XP conference 2016
Introduction to Docker - Learning containerization XP conference 2016
 
Docker & FieldAware
Docker & FieldAwareDocker & FieldAware
Docker & FieldAware
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
 
Learning Docker with Thomas
Learning Docker with ThomasLearning Docker with Thomas
Learning Docker with Thomas
 
Docker 101
Docker 101Docker 101
Docker 101
 

Recently uploaded

Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
DhatriParmar
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 

Docker basics 30_01_21.ppx

  • 2. - O L D S C H O O L D E V E L O P M E N T - I N T R O D U C T I O N T O C O N T A I N E R - W H Y W E N E E D C O N T A I N E R ? - D O C K E R V S V I R T U A L M A C H I N E - D O C K E R O V E R V I E W - D O C K E R B U I L D - D O C K E R R E G I S T R Y - D O C K E R R U N A G E N D A
  • 3. O L D S C H O O L D E P L O Y M E N T D E V E L O P E R O P E R A T O R I sent a copy into SMTP server already Got it!, I will deploy soon. Deployment day
  • 4. O L D S C H O O L D E P L O Y M E N T D E V E L O P E R O P E R A T O R …. …. Deploying…. Deployment day
  • 5. O L D S C H O O L D E P L O Y M E N T D E V E L O P E R O P E R A T O R Yepp!! Let see the results Deployment day Deploy completed !!
  • 6. O L D S C H O O L D E P L O Y M E N T D E V E L O P E R O P E R A T O R Its work on my machine !! It’s crash !! Deployment day
  • 7.
  • 9. T H E M O S T P O P U L A R C O N T A I N E R M A N A G E R . D O C K E R
  • 11. Docker overview Dockerfile Image Registry Container Push image Pull image & run Build Ship Run
  • 12. Docker build What is Dockerfile ? - Dockerfile describes step by step instructions of all the commands you need to run to assemble a Docker Image. “Docker build” command “docker build” command processes Dockerfile generating a Docker Image in your Local Image Cache, which you can then start-up using the “docker run” command, or push to a permanent Image Repository $ docker build -t <IMAGE_NAME> .
  • 13. Docker Registry What is Docker Registry ? - A registry is a storage and content delivery system, holding named Docker images, available in different tagged versions. eg. Docker Hub, Quay.io, GCR, ECR “Docker Push” command “docker push” command helps you to push Docker images to the Docker registry. $ docker push [IMAGE:TAG]
  • 14. Docker Run “Docker Run” command -“docker run” command helps you to run Docker image as a container instance. General Command Form The basic “docker run” command takes this form: $ docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...] $ docker run -it ubuntu
  • 16. Docker push(demo) Image Registry Container Push image Pull image & run Ship Run
  • 17. 1.Installation ⁃ Windows -> https://docs.docker.com/docker-for-windows/install/ ⁃ mac0S -> https://docs.docker.com/docker-for-mac/install/ ⁃ Linux Ubuntu $ sudo apt update $ sudo apt install docker.io $ sudo docker run hello-word Terminal/ iTerm 1. Register docker hub 2. login docker on terminal - $docker login
  • 18. 2.Create project . ├── Dockerfile └── main.py 0 directories, 2 files Normally you should have this folder architecture:
  • 19. 3. Edit python file #!/usr/bin/env python3 print(“My first container with python”) You can add the following code to the ‘main.py’ file:
  • 20. 4. Edit dockerfile # A dockerfile must always start by importing the base image. # We use the keyword 'FROM' to do that. # In our example, we want import the python image. # So we write 'python' for the image name and 'latest' for the version. FROM python:latest # In order to launch our python code, we must import it into our image. # We use the keyword 'COPY' to do that. # The first parameter 'main.py' is the name of the file on the host. # The second parameter '/' is the path where to put the file on the image. # Here we put the file at the image root folder. COPY main.py / # We need to define the command to launch when we are going to run the image. # We use the keyword 'CMD' to do that. # The following command will execute "python ./main.py". CMD [ "python", "./main.py" ]
  • 21. 5. Create docker image $ docker build -t python-test 6. Run docker image $ docker run python-test The ’-t’ option allows you to define the name of your image. In our case we have chosen ’python-test’ but you can put what you want. There you go, that’s it. You should normally see “My first container with python” displayed in your terminal.
  • 22. Nginx demo $ docker pull nginx:stable Run nginx image $ docker run --name nginx-webserver1 -v /var/www/html:/usr/share/nginx/html:ro -p 8080:80 -d nginx:stable Results - open browser - Type localhost:8080 <html><title> Docker </title> <body> Docker nginx </body> </html> /var/www/html/index.html
  • 23. Useful commands for Docker • List your images. $ docker image ls • Delete a specific image. $ docker image rm [image name] • Delete all existing images. $ docker image rm $(docker images -a -q) • List all existing containers (running and not running). $ docker ps -a Delete specific only container (if only stopped) $ docker rm [container name] Delete all containers (only stopped) $ docker rmi [image name ] Search images $ docker search [image name] Display logs of a container $ docker logs [container name]
  • 24. Documents - https://docs.docker.com Docker online simulator - https://www.katacoda.com/courses/docker/deploying-first-container