SlideShare a Scribd company logo
Docker Engine hands on
2020-11-18
Orozco Hsu
Agenda
• Docker engine
• Create your first docker environment
• Docker CLI
• Docker API
• Docker network
• Docker volume
Docker engine
Docker engine
Create your first docker environment
• Install VMware Workstation 15 Pro in your laptop
• https://mega.nz/file/zHxlyASC#47BjSzA8iR26nUT4g4YVVWTw0eo-
qchQzPygLI4sE4U
• Install CentOS7 (CentOS-7-x86_64-DVD-2003.iso)
• https://mirrors.aliyun.com/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-
2009.iso
• Install Putty
• https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Create your first docker environment
• System configuration
• Memory: 4096 MB+
• CPU: 1 Processors+
• Hard Disk: 30GB+
Create your first docker environment
• Install putty as your terminal tool
• Get your IP RUN => ip addr
Create your first docker environment
• Use putty to connect your host
putty.exe
Create your first docker environment
• Install docker
• RUN =>
• RUN =>
• RUN =>
• RUN =>
• RUN =>
curl -sSL https://get.docker.com | sh
reboot
systemctl start docker
systemctl status docker
usermod -aG docker root
Add root to dockerroot group
Docker CLI
• Command
• RUN =>
• RUN =>
• RUN =>
• RUN =>
• RUN =>
• RUN =>
• RUN =>
docker help
docker run --help
docker search alpine
docker pull alpine
docker images
docker tag alpine orozcohsu/alpine:v1
docker rmi -f orozcohsu/alpine:v1
Docker API
Docker API
• Configuration
• RUN =>
• RUN =>
• RUN =>
• RUN =>
• RUN =>
mkdir /etc/systemd/system/docker.service.d
systemctl daemon-reload
vi /etc/systemd/system/docker.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375
systemctl restart docker
systemctl stop firewalld; systemctl status firewalld
Docker API
• API is enable
• RUN =>
• RUN => docker info
systemctl restart docker
docker service must be restarting because of disable firewall
Docker API
• Restful API (pull a image and run)
• RUN =>
• RUN =>
• RUN =>
curl -v -XPOST http://192.168.159.144:2375/images/create?fromImage=nginx:latest
curl http://192.168.159.144:2375/images/json | grep RepoTags
Find local images
curl -v -XPOST http://192.168.159.144:2375/images/create?fromImage=hermsi/alpine-sshd:latest
Docker API
• Restful API (pull a image and run)
• RUN => curl -X POST -H "Content-Type: application/json" -d 
'{
"Hostname":"", "User":"", "Memory":0,
"MemorySwap":0, "AttachStdin":false,
"AttachStdout":true,"AttachStderr":true,
"PortSpecs":null,"Tty":false,"OpenStdin":false,
"StdinOnce":false,"Env":null,"Cmd":["nginx", "-g", "daemon off;"],
"Image":"nginx", "Tag":"latest",
"Volumes":{"/tmp":{}},
"WorkingDir":"","DisableNetwork":false,
"ExposedPorts":{"22/tcp": {} }
}' http://192.168.159.144:2375/containers/create
Try to check container status
Docker API
• Restful API (pull a image and run)
• RUN =>
• RUN =>
curl -X POST http://192.168.159.144:2375/containers/ID/start
The initialized status of docker is in Created, use start to change its status to Up
curl http://192.168.159.144:2375/containers/json?all=1
Try to docker exec and go to container
Docker API
• Restful API (check container)
• RUN =>
• RUN =>
• RUN =>
• RUN =>
curl -X POST http://192.168.159.144:2375/containers/ID/stop
curl -X POST http://192.168.159.141:2375/containers/ID/restart?t=5
curl -X POST http://192.168.159.141:2375/containers/ID/kill
curl http://192.168.159.144:2375/containers/ID/top
number of seconds to wait before killing the container
Try to check container status
Docker API
• Parameters reference
• https://docs.docker.com/engine/api/v1.24/#31-containers
Docker network
Docker network
• Try to synchronize local folder with container volume
• RUN =>
• RUN =>
docker run -d --rm -p 4001:22 --env ROOT_PASSWORD=1234 hermsi/alpine-sshd
docker run -d --rm -p 4002:22 --env ROOT_PASSWORD=1234 hermsi/alpine-sshd
Try to check container information
Docker network
• Use putty to connect those containers
Docker volume
• Try to use putty and connect to different linux container
• RUN =>
• RUN =>
docker run -d --rm -v /tmp/app:/app --env ROOT_PASSWORD=1234 hermsi/alpine-sshd
touch /tmp/app/test.txt
Try to check local folder /tmp/app and container folder /app

More Related Content

PPTX
Building Windows Images with Packer
PDF
Docker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQ
PDF
Deploying to Ubuntu on Linode
PPTX
Packer, where DevOps begins
PDF
Steam Learn: Composer
PDF
Microsoft Docker Meetup - Tutum Spring 2015
PDF
Declare your infrastructure: InfraKit, LinuxKit and Moby
PDF
Virtualization with Vagrant (ua.pycon 2011)
Building Windows Images with Packer
Docker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQ
Deploying to Ubuntu on Linode
Packer, where DevOps begins
Steam Learn: Composer
Microsoft Docker Meetup - Tutum Spring 2015
Declare your infrastructure: InfraKit, LinuxKit and Moby
Virtualization with Vagrant (ua.pycon 2011)

What's hot (20)

PDF
IaC를 어쭙잖게 맛본 썰?! Ctrl + c/v vs Ansible
PDF
OSS AWS 핸즈온 강의
PDF
Alluxio in MOMO
PDF
Automated Hadoop Cluster Construction on EC2
PDF
Node.js - A Quick Tour II
PDF
2013 PyCon SG - Building your cloud infrastructure with Python
PDF
Everyone Loves a Sausage
PDF
Complementing Docker with Puppet
PDF
The Practice of Alluxio in Near Real-Time Data Platform at VIPShop [Chinese]
PDF
Openstack at NTT Feb 7, 2011
KEY
Introduction to NodeJS with LOLCats
PDF
PDF
Introduction to Docker
PPTX
Baking in the cloud with packer and puppet
PDF
PDF
Caching in Docker - the hardest thing in computer science
PDF
Create a RESTful API with NodeJS, Express and MongoDB
PPTX
How to manage Microsoft Azure with open source
PDF
Ansible is the simplest way to automate. MoldCamp, 2015
PDF
Docker Tutorial
IaC를 어쭙잖게 맛본 썰?! Ctrl + c/v vs Ansible
OSS AWS 핸즈온 강의
Alluxio in MOMO
Automated Hadoop Cluster Construction on EC2
Node.js - A Quick Tour II
2013 PyCon SG - Building your cloud infrastructure with Python
Everyone Loves a Sausage
Complementing Docker with Puppet
The Practice of Alluxio in Near Real-Time Data Platform at VIPShop [Chinese]
Openstack at NTT Feb 7, 2011
Introduction to NodeJS with LOLCats
Introduction to Docker
Baking in the cloud with packer and puppet
Caching in Docker - the hardest thing in computer science
Create a RESTful API with NodeJS, Express and MongoDB
How to manage Microsoft Azure with open source
Ansible is the simplest way to automate. MoldCamp, 2015
Docker Tutorial
Ad

Similar to 2 docker engine_hands_on (20)

PDF
1 docker first_linux_container_hands_on
 
PPTX
PDF
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
PPTX
Powercoders · Docker · Fall 2021.pptx
PDF
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
PDF
Introduction to Docker, December 2014 "Tour de France" Edition
PDF
Introduction to Docker and deployment and Azure
PDF
Docker, the Future of DevOps
PDF
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
PDF
Introduction to Docker at Glidewell Laboratories in Orange County
PDF
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
PPTX
Docker workshop
PDF
Docker Intro
PPTX
Docker Ecosystem on Azure
PDF
Introduction to Docker at the Azure Meet-up in New York
PDF
手把手帶你學Docker 03042017
PDF
Présentation de Docker
PDF
Monitoring Docker at Scale - Docker San Francisco Meetup - August 11, 2015
PDF
Docker fundamentals
PDF
Docker - From Walking To Running
1 docker first_linux_container_hands_on
 
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Powercoders · Docker · Fall 2021.pptx
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Introduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker and deployment and Azure
Docker, the Future of DevOps
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Introduction to Docker at Glidewell Laboratories in Orange County
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
Docker workshop
Docker Intro
Docker Ecosystem on Azure
Introduction to Docker at the Azure Meet-up in New York
手把手帶你學Docker 03042017
Présentation de Docker
Monitoring Docker at Scale - Docker San Francisco Meetup - August 11, 2015
Docker fundamentals
Docker - From Walking To Running
Ad

More from FEG (20)

PDF
Supervised learning in decision tree algorithm
 
PDF
Unsupervised learning in data clustering
 
PDF
CNN_Image Classification for deep learning.pdf
 
PDF
Sequence Model with practicing hands on coding.pdf
 
PDF
Seq2seq Model introduction with practicing hands on coding.pdf
 
PDF
AIGEN introduction with practicing hands on coding.pdf
 
PDF
資料視覺化_Exploation_Data_Analysis_20241015.pdf
 
PDF
Operation_research_Linear_programming_20241015.pdf
 
PDF
Operation_research_Linear_programming_20241112.pdf
 
PDF
非監督是學習_Kmeans_process_visualization20241110.pdf
 
PDF
Sequence Model pytorch at colab with gpu.pdf
 
PDF
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf
 
PDF
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf
 
PDF
Pytorch cnn netowork introduction 20240318
 
PDF
2023 Decision Tree analysis in business practices
 
PDF
2023 Clustering analysis using Python from scratch
 
PDF
2023 Data visualization using Python from scratch
 
PDF
2023 Supervised Learning for Orange3 from scratch
 
PDF
2023 Supervised_Learning_Association_Rules
 
PDF
202312 Exploration Data Analysis Visualization (English version)
 
Supervised learning in decision tree algorithm
 
Unsupervised learning in data clustering
 
CNN_Image Classification for deep learning.pdf
 
Sequence Model with practicing hands on coding.pdf
 
Seq2seq Model introduction with practicing hands on coding.pdf
 
AIGEN introduction with practicing hands on coding.pdf
 
資料視覺化_Exploation_Data_Analysis_20241015.pdf
 
Operation_research_Linear_programming_20241015.pdf
 
Operation_research_Linear_programming_20241112.pdf
 
非監督是學習_Kmeans_process_visualization20241110.pdf
 
Sequence Model pytorch at colab with gpu.pdf
 
學院碩士班_非監督式學習_使用Orange3直接使用_分群_20240417.pdf
 
資料視覺化_透過Orange3進行_無須寫程式直接使用_碩士學程_202403.pdf
 
Pytorch cnn netowork introduction 20240318
 
2023 Decision Tree analysis in business practices
 
2023 Clustering analysis using Python from scratch
 
2023 Data visualization using Python from scratch
 
2023 Supervised Learning for Orange3 from scratch
 
2023 Supervised_Learning_Association_Rules
 
202312 Exploration Data Analysis Visualization (English version)
 

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Approach and Philosophy of On baking technology
PPT
Teaching material agriculture food technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Empathic Computing: Creating Shared Understanding
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
KodekX | Application Modernization Development
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Cloud computing and distributed systems.
Reach Out and Touch Someone: Haptics and Empathic Computing
The Rise and Fall of 3GPP – Time for a Sabbatical?
Diabetes mellitus diagnosis method based random forest with bat algorithm
Approach and Philosophy of On baking technology
Teaching material agriculture food technology
Digital-Transformation-Roadmap-for-Companies.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Unlocking AI with Model Context Protocol (MCP)
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
NewMind AI Monthly Chronicles - July 2025
Empathic Computing: Creating Shared Understanding
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Per capita expenditure prediction using model stacking based on satellite ima...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
KodekX | Application Modernization Development
Mobile App Security Testing_ A Comprehensive Guide.pdf
Cloud computing and distributed systems.

2 docker engine_hands_on

  • 1. Docker Engine hands on 2020-11-18 Orozco Hsu
  • 2. Agenda • Docker engine • Create your first docker environment • Docker CLI • Docker API • Docker network • Docker volume
  • 5. Create your first docker environment • Install VMware Workstation 15 Pro in your laptop • https://mega.nz/file/zHxlyASC#47BjSzA8iR26nUT4g4YVVWTw0eo- qchQzPygLI4sE4U • Install CentOS7 (CentOS-7-x86_64-DVD-2003.iso) • https://mirrors.aliyun.com/centos/7/isos/x86_64/CentOS-7-x86_64-DVD- 2009.iso • Install Putty • https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
  • 6. Create your first docker environment • System configuration • Memory: 4096 MB+ • CPU: 1 Processors+ • Hard Disk: 30GB+
  • 7. Create your first docker environment • Install putty as your terminal tool • Get your IP RUN => ip addr
  • 8. Create your first docker environment • Use putty to connect your host putty.exe
  • 9. Create your first docker environment • Install docker • RUN => • RUN => • RUN => • RUN => • RUN => curl -sSL https://get.docker.com | sh reboot systemctl start docker systemctl status docker usermod -aG docker root Add root to dockerroot group
  • 10. Docker CLI • Command • RUN => • RUN => • RUN => • RUN => • RUN => • RUN => • RUN => docker help docker run --help docker search alpine docker pull alpine docker images docker tag alpine orozcohsu/alpine:v1 docker rmi -f orozcohsu/alpine:v1
  • 12. Docker API • Configuration • RUN => • RUN => • RUN => • RUN => • RUN => mkdir /etc/systemd/system/docker.service.d systemctl daemon-reload vi /etc/systemd/system/docker.service.d/override.conf [Service] ExecStart= ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 systemctl restart docker systemctl stop firewalld; systemctl status firewalld
  • 13. Docker API • API is enable • RUN => • RUN => docker info systemctl restart docker docker service must be restarting because of disable firewall
  • 14. Docker API • Restful API (pull a image and run) • RUN => • RUN => • RUN => curl -v -XPOST http://192.168.159.144:2375/images/create?fromImage=nginx:latest curl http://192.168.159.144:2375/images/json | grep RepoTags Find local images curl -v -XPOST http://192.168.159.144:2375/images/create?fromImage=hermsi/alpine-sshd:latest
  • 15. Docker API • Restful API (pull a image and run) • RUN => curl -X POST -H "Content-Type: application/json" -d '{ "Hostname":"", "User":"", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true,"AttachStderr":true, "PortSpecs":null,"Tty":false,"OpenStdin":false, "StdinOnce":false,"Env":null,"Cmd":["nginx", "-g", "daemon off;"], "Image":"nginx", "Tag":"latest", "Volumes":{"/tmp":{}}, "WorkingDir":"","DisableNetwork":false, "ExposedPorts":{"22/tcp": {} } }' http://192.168.159.144:2375/containers/create Try to check container status
  • 16. Docker API • Restful API (pull a image and run) • RUN => • RUN => curl -X POST http://192.168.159.144:2375/containers/ID/start The initialized status of docker is in Created, use start to change its status to Up curl http://192.168.159.144:2375/containers/json?all=1 Try to docker exec and go to container
  • 17. Docker API • Restful API (check container) • RUN => • RUN => • RUN => • RUN => curl -X POST http://192.168.159.144:2375/containers/ID/stop curl -X POST http://192.168.159.141:2375/containers/ID/restart?t=5 curl -X POST http://192.168.159.141:2375/containers/ID/kill curl http://192.168.159.144:2375/containers/ID/top number of seconds to wait before killing the container Try to check container status
  • 18. Docker API • Parameters reference • https://docs.docker.com/engine/api/v1.24/#31-containers
  • 20. Docker network • Try to synchronize local folder with container volume • RUN => • RUN => docker run -d --rm -p 4001:22 --env ROOT_PASSWORD=1234 hermsi/alpine-sshd docker run -d --rm -p 4002:22 --env ROOT_PASSWORD=1234 hermsi/alpine-sshd Try to check container information
  • 21. Docker network • Use putty to connect those containers
  • 22. Docker volume • Try to use putty and connect to different linux container • RUN => • RUN => docker run -d --rm -v /tmp/app:/app --env ROOT_PASSWORD=1234 hermsi/alpine-sshd touch /tmp/app/test.txt Try to check local folder /tmp/app and container folder /app