SlideShare a Scribd company logo
Orchestration Basics
AcademyPRO
Today’s
agenda
Docker Networking Basics
Compose
Scaling out with Swarm Mode
Default Networks
When you install Docker, it creates three networks automatically. You can list
these networks using the docker network ls command:
docker network ls
NETWORK ID NAME DRIVER
7fca4eb8c647 bridge bridge
9f904ee27bf5 none null
cf03ee007fb4 host host
These three networks are built into Docker. When you run a container, you can
use the --network flag to specify which networks your container should
connect to.
Create network
A bridge - default networking mode which will enable the connectivity to the
other interfaces of the host machine as well as among containers.
A none will not configure any IP for the container and doesn’t have any access
to the external network as well as for other containers
A host container will share the host’s network stack and all interfaces from the
host will be available to the container
docker network create isolated_nw
docker network inspect isolated_nw
Create network
After you create the network, you can launch containers on it using the docker
run --network=<NETWORK> option.
$ docker run --network=isolated_nw -itd --name=container1
busybox
$ docker network inspect isolated_nw
Network
The containers you launch into this network must reside on the same Docker
host. Each container in the network can immediately communicate with other
containers in the network. Though, the network itself isolates the containers
from external networks.
Published ports
Within a user-defined network, linking is not supported. You can expose and
publish container ports on containers in this network. This is useful if you want
to make a portion of the network available to an outside network.
Let’s try!
docker run -d --net isolated_nw -p 27017:27017 --name
mongo_container mongo
docker run -d --net isolated_nw -p 3000:3000 --name
node_container oleksandrkovalov/node_example_2
Docker Compose
Compose is a tool for defining and running multi-container Docker applications.
With Compose, you use a Compose file to configure your application’s services.
Then, using a single command, you create and start all the services from your
configuration.
Compose usage
Using Compose is basically a three-step process.
Define your app’s environment with a Dockerfile so it can be reproduced
anywhere.
Define the services that make up your app in docker-compose.yml so
they can be run together in an isolated environment.
Lastly, run docker-compose up and Compose will start and run your entire
app.
Compose status
docker-compose ps
Name Command State Ports
------------------------------------------------------------------------------------------
nodeapp_mongo_container_1 docker-entrypoint.sh mongod Up 0.0.0.0:27017->27017/tcp
nodeapp_node_container_1 npm start Up 0.0.0.0:3000->3000/tcp
docker-compose down
docker-compose.yml
version: '3'
services:
node_container:
networks:
- isolated_nw
image: "oleksandrkovalov/node_example_2"
links:
- mongo_container
ports:
- "3000:3000"
mongo_container:
networks:
- isolated_nw
image: "mongo"
ports:
- "27017:27017"
networks:
isolated_nw:
docker-compose.yml
build
Configuration options that are applied at build time.
build can be specified either as a string containing a path to the build context,
or an object with the path specified under context and optionally dockerfile and
args.
build: ./dir
docker-compose.yml
build
build:
dockerfile: Dockerfile-alternate
If you specify image as well as build, then Compose names the built image with
the webapp and optional tag specified in image:
build: ./dir
image: webapp:tag
docker-compose.yml
build: CONTEXT
Either a path to a directory containing a Dockerfile, or a url to a git repository.
When the value supplied is a relative path, it is interpreted as relative to the
location of the Compose file. This directory is also the build context that is sent
to the Docker daemon.
Compose will build and tag it with a generated name, and use that image
thereafter.
build:
context: ./dir
docker-compose.yml
build: DOCKERFILE
Compose will use an alternate file to build with. A build path must also be
specified.
build:
context: .
dockerfile: Dockerfile-alternate
docker-compose.yml
build: ARGS
Add build arguments, which are environment variables accessible only during
the build process.
First, specify the arguments in your Dockerfile:
ARG buildno
ARG password
RUN echo "Build number: $buildno"
RUN script-requiring-password.sh "$password"
docker-compose.yml
build: ARGS
Then specify the arguments under the build key. You can pass either a mapping
or a list:
build:
context: .
args:
- buildno=1
- password=secret
docker-compose.yml
build: command
Override the default command.
command: bundle exec thin -p 3000
The command can also be a list, in a manner similar to dockerfile:
command: [bundle, exec, thin, -p, 3000]
Disconnecting containers
You can disconnect a container from a network at any time using the docker
network disconnect command.
Disconnect container1 from the isolated_nw network, then inspect container1
and the isolated_nw network.
docker network disconnect isolated_nw container1
docker network inspect isolated_nw
Remove a network
When all the containers in a network are stopped or disconnected, you can
remove a network. If a network has connected endpoints, an error occurs.
docker network inspect isolated_nw
docker network rm isolated_nw
docker network ls
Docker Swarm
Docker Swarm is the Docker-native solution for deploying a cluster of Docker
hosts. You can use it to quickly deploy a cluster of Docker hosts running either
on your local machine or on supported cloud platforms.
How Swarm nodes works
Docker Engine 1.12 introduces swarm
mode that enables you to create a
cluster of one or more Docker Engines
called a swarm. A swarm consists of
one or more nodes: physical or virtual
machines running Docker Engine 1.12
or later in swarm mode.
There are two types of nodes:
managers and workers.
How services work
To deploy an application image when
Docker Engine is in swarm mode, you
create a service. Frequently a service will
be the image for a microservice within the
context of some larger application.
Examples of services might include an
HTTP server, a database, or any other type
of executable program that you wish to
run in a distributed environment.
Create a swarm
docker swarm init
docker info
......
Swarm: active
NodeID: dxn1zf6l61qsb1josjja83ngz
Is Manager: true
Managers: 1
Nodes: 1
......
Inspect nodes
docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
phfku7dign7xvzppcb0i9fzqj * moby Ready Active Leader
Add nodes to the swarm
docker swarm join-token -q manager
docker swarm join 
--token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-8vxv8rssmk743ojnwacrr2e7c 
192.168.99.100:2377
Deploy a service to the swarm
docker service create --name helloworld --replicas 3 -p 80:80 --network isolated_nw tutum/hello-world
docker service create --name bash --network isolated_nw ubuntu
docker service ls
h3uvf93xt72b bash replicated 1/1 ubuntu:latest
tee36wrfs1z8 helloworld replicated 3/3 tutum/hello-world:latest
docker exec -it 133e43b35f30 bash
apt-get update
apt-get install curl
curl http://helloworld
Inspect a service on the swarm
docker service ls
docker service inspect --pretty tee36wrfs1z8
docker service ps tee36wrfs1z8
Scale the service in the swarm
docker service scale <SERVICE-ID>=<NUMBER-OF-TASKS>
docker service scale tee36wrfs1z8=4
tee36wrfs1z8rh63c7lkxrfzw scaled to 4
Docker-compose.yml
features for swarm
deploy
version: '3'
services:
redis:
image: redis:alpine
deploy:
replicas: 6
update_config:
parallelism: 2
delay: 10s
restart_policy:
condition: on-failure
Docker-compose.yml
features for swarm: UPDATE_CONFIG
Configures how the service should be updated. Useful for configuring rolling
updates.
parallelism: The number of containers to update at a time.
delay: The time to wait between updating a group of containers.
failure_action: What to do if an update fails. One of continue or pause (default:
pause).
monitor: Duration after each task update to monitor for failure
(ns|us|ms|s|m|h) (default 0s).
Docker-compose.yml
features for swarm: UPDATE_CONFIG
version: '3'
services:
vote:
image: dockersamples/examplevotingapp_vote:before
depends_on:
- redis
deploy:
replicas: 2
update_config:
parallelism: 2
delay: 10s
Docker-compose.yml
features for swarm: RESOURCES
Configures resource constraints.
version: '3'
services:
redis:
image: redis:alpine
deploy:
resources:
limits:
cpus: '0.001'
memory: 50M
reservations:
cpus: '0.0001'
memory: 20M
Docker-compose.yml
features for swarm: RESTART_POLICY
Configures if and how to restart containers when they exit. Replaces restart.
condition: One of none, on-failure or any (default: any).
delay: How long to wait between restart attempts, specified as a duration
(default: 0).
max_attempts: How many times to attempt to restart a container before
giving up (default: never give up).
window: How long to wait before deciding if a restart has succeeded, specified
as a duration (default: decide immediately).
Docker-compose.yml
features for swarm: RESTART_POLICY
version: "3"
services:
redis:
image: redis:alpine
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
Any questions?
The end
for today :)

More Related Content

PPTX
Academy PRO: Docker. Lecture 4
PPTX
Academy PRO: Docker. Part 2
PPTX
Academy PRO: Docker. Part 1
PPTX
Academy PRO: Docker. Part 4
PDF
Docker 原理與實作
PPTX
Docker orchestration
PDF
The state of the swarm
PDF
Docker at Flux7
Academy PRO: Docker. Lecture 4
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 4
Docker 原理與實作
Docker orchestration
The state of the swarm
Docker at Flux7

What's hot (20)

PDF
Docker Distributed application bundle & Stack - Overview
PDF
GDG Lima - Docker Compose
PDF
Docker Swarm & Machine
PDF
Rapid Development With Docker Compose
PPTX
Docker on openstack by OpenSource Consulting
PPTX
Docker advance1
PDF
Docker 활용법: dumpdocker
PDF
Docker puebla bday #4 celebration
PDF
CoreOSによるDockerコンテナのクラスタリング
PDF
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
PDF
Intersog Hack_n_Tell. Docker. First steps.
PPTX
Docker for Web Developers: A Sneak Peek
PPTX
Docker advance topic
PDF
From zero to Docker
PPTX
Docker workshop
PDF
Containerizing Web Application with Docker
PPTX
How to _docker
PDF
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
PDF
Docker 101 - from 0 to Docker in 30 minutes
PDF
Docker in everyday development
Docker Distributed application bundle & Stack - Overview
GDG Lima - Docker Compose
Docker Swarm & Machine
Rapid Development With Docker Compose
Docker on openstack by OpenSource Consulting
Docker advance1
Docker 활용법: dumpdocker
Docker puebla bday #4 celebration
CoreOSによるDockerコンテナのクラスタリング
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
Intersog Hack_n_Tell. Docker. First steps.
Docker for Web Developers: A Sneak Peek
Docker advance topic
From zero to Docker
Docker workshop
Containerizing Web Application with Docker
How to _docker
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker 101 - from 0 to Docker in 30 minutes
Docker in everyday development
Ad

Viewers also liked (9)

PPTX
Oracle database on Docker Container
PPTX
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
PDF
Making DevOps Secure with Docker on Solaris (Oracle Open World, with Jesse Bu...
PDF
Oracle Advanced SQL and Analytic Functions
PDF
Docker in the Oracle Universe / WebLogic 12c / OFM 12c
PPTX
Academy PRO: D3, part 3
PDF
Docker 101: Introduction to Docker
PPTX
Docker introduction
PDF
Alphorm.com Formation Docker (2/2) - Administration Avancée
Oracle database on Docker Container
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Making DevOps Secure with Docker on Solaris (Oracle Open World, with Jesse Bu...
Oracle Advanced SQL and Analytic Functions
Docker in the Oracle Universe / WebLogic 12c / OFM 12c
Academy PRO: D3, part 3
Docker 101: Introduction to Docker
Docker introduction
Alphorm.com Formation Docker (2/2) - Administration Avancée
Ad

Similar to Academy PRO: Docker. Lecture 3 (20)

PPTX
Docker Basic to Advance
PPTX
Docker session IV: Docker Compose and Docker Swarm
PDF
Deep Dive into Docker Swarm Mode
PPTX
Docker for the new Era: Introducing Docker,its components and tools
PDF
Swarm mode
PDF
Docker compose and swarm
PDF
Docker HK Meetup - 201707
PPTX
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
PDF
New Docker Features for Orchestration and Containers
PDF
Dockers & kubernetes detailed - Beginners to Geek
PDF
Docker - From Walking To Running
PDF
Introduction to Docker and Monitoring with InfluxData
PPTX
Nats meetup oct 2016 docker 112
PDF
Docker Essentials Workshop— Innovation Labs July 2020
PPTX
Docker
PDF
Docker, but what it is?
PDF
Docker for developers on mac and windows
PPTX
Docker Introduction and its Usage in Machine Learning
PDF
Docker Intro
PDF
手把手帶你學 Docker 入門篇
Docker Basic to Advance
Docker session IV: Docker Compose and Docker Swarm
Deep Dive into Docker Swarm Mode
Docker for the new Era: Introducing Docker,its components and tools
Swarm mode
Docker compose and swarm
Docker HK Meetup - 201707
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
New Docker Features for Orchestration and Containers
Dockers & kubernetes detailed - Beginners to Geek
Docker - From Walking To Running
Introduction to Docker and Monitoring with InfluxData
Nats meetup oct 2016 docker 112
Docker Essentials Workshop— Innovation Labs July 2020
Docker
Docker, but what it is?
Docker for developers on mac and windows
Docker Introduction and its Usage in Machine Learning
Docker Intro
手把手帶你學 Docker 入門篇

More from Binary Studio (20)

PPTX
Academy PRO: D3, part 1
PPTX
Academy PRO: Cryptography 3
PPTX
Academy PRO: Cryptography 1
PPTX
Academy PRO: Advanced React Ecosystem. MobX
PPTX
Binary Studio Academy 2017: JS team project - Orderly
PPTX
Binary Studio Academy 2017: .NET team project - Unicorn
PPTX
Academy PRO: React native - miscellaneous
PPTX
Academy PRO: React native - publish
PPTX
Academy PRO: React native - navigation
PPTX
Academy PRO: React native - building first scenes
PPTX
Academy PRO: React Native - introduction
PPTX
Academy PRO: Push notifications. Denis Beketsky
PPTX
Academy PRO: Docker. Lecture 2
PPTX
Academy PRO: Docker. Lecture 1
PPTX
Academy PRO: Node.js - miscellaneous. Lecture 5
PPTX
Academy PRO: Node.js in production. lecture 4
PPTX
Academy PRO: Node.js alternative stacks. Lecture 3
PPTX
Academy PRO: Node.js default stack. Lecture 2
PPTX
Academy PRO: Node.js platform. Lecture 1
PPTX
SubmitJS: Developing desktop applications with Electron. Mykyta Semenistyi
Academy PRO: D3, part 1
Academy PRO: Cryptography 3
Academy PRO: Cryptography 1
Academy PRO: Advanced React Ecosystem. MobX
Binary Studio Academy 2017: JS team project - Orderly
Binary Studio Academy 2017: .NET team project - Unicorn
Academy PRO: React native - miscellaneous
Academy PRO: React native - publish
Academy PRO: React native - navigation
Academy PRO: React native - building first scenes
Academy PRO: React Native - introduction
Academy PRO: Push notifications. Denis Beketsky
Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 1
Academy PRO: Node.js - miscellaneous. Lecture 5
Academy PRO: Node.js in production. lecture 4
Academy PRO: Node.js alternative stacks. Lecture 3
Academy PRO: Node.js default stack. Lecture 2
Academy PRO: Node.js platform. Lecture 1
SubmitJS: Developing desktop applications with Electron. Mykyta Semenistyi

Recently uploaded (20)

PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Mushroom cultivation and it's methods.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Empathic Computing: Creating Shared Understanding
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Spectroscopy.pptx food analysis technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
A comparative analysis of optical character recognition models for extracting...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Group 1 Presentation -Planning and Decision Making .pptx
Mushroom cultivation and it's methods.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
Encapsulation theory and applications.pdf
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Empathic Computing: Creating Shared Understanding
Diabetes mellitus diagnosis method based random forest with bat algorithm
Building Integrated photovoltaic BIPV_UPV.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Spectroscopy.pptx food analysis technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Network Security Unit 5.pdf for BCA BBA.
Reach Out and Touch Someone: Haptics and Empathic Computing

Academy PRO: Docker. Lecture 3

  • 3. Default Networks When you install Docker, it creates three networks automatically. You can list these networks using the docker network ls command: docker network ls NETWORK ID NAME DRIVER 7fca4eb8c647 bridge bridge 9f904ee27bf5 none null cf03ee007fb4 host host These three networks are built into Docker. When you run a container, you can use the --network flag to specify which networks your container should connect to.
  • 4. Create network A bridge - default networking mode which will enable the connectivity to the other interfaces of the host machine as well as among containers. A none will not configure any IP for the container and doesn’t have any access to the external network as well as for other containers A host container will share the host’s network stack and all interfaces from the host will be available to the container docker network create isolated_nw docker network inspect isolated_nw
  • 5. Create network After you create the network, you can launch containers on it using the docker run --network=<NETWORK> option. $ docker run --network=isolated_nw -itd --name=container1 busybox $ docker network inspect isolated_nw
  • 6. Network The containers you launch into this network must reside on the same Docker host. Each container in the network can immediately communicate with other containers in the network. Though, the network itself isolates the containers from external networks.
  • 7. Published ports Within a user-defined network, linking is not supported. You can expose and publish container ports on containers in this network. This is useful if you want to make a portion of the network available to an outside network.
  • 8. Let’s try! docker run -d --net isolated_nw -p 27017:27017 --name mongo_container mongo docker run -d --net isolated_nw -p 3000:3000 --name node_container oleksandrkovalov/node_example_2
  • 9. Docker Compose Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a Compose file to configure your application’s services. Then, using a single command, you create and start all the services from your configuration.
  • 10. Compose usage Using Compose is basically a three-step process. Define your app’s environment with a Dockerfile so it can be reproduced anywhere. Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment. Lastly, run docker-compose up and Compose will start and run your entire app.
  • 11. Compose status docker-compose ps Name Command State Ports ------------------------------------------------------------------------------------------ nodeapp_mongo_container_1 docker-entrypoint.sh mongod Up 0.0.0.0:27017->27017/tcp nodeapp_node_container_1 npm start Up 0.0.0.0:3000->3000/tcp docker-compose down
  • 12. docker-compose.yml version: '3' services: node_container: networks: - isolated_nw image: "oleksandrkovalov/node_example_2" links: - mongo_container ports: - "3000:3000" mongo_container: networks: - isolated_nw image: "mongo" ports: - "27017:27017" networks: isolated_nw:
  • 13. docker-compose.yml build Configuration options that are applied at build time. build can be specified either as a string containing a path to the build context, or an object with the path specified under context and optionally dockerfile and args. build: ./dir
  • 14. docker-compose.yml build build: dockerfile: Dockerfile-alternate If you specify image as well as build, then Compose names the built image with the webapp and optional tag specified in image: build: ./dir image: webapp:tag
  • 15. docker-compose.yml build: CONTEXT Either a path to a directory containing a Dockerfile, or a url to a git repository. When the value supplied is a relative path, it is interpreted as relative to the location of the Compose file. This directory is also the build context that is sent to the Docker daemon. Compose will build and tag it with a generated name, and use that image thereafter. build: context: ./dir
  • 16. docker-compose.yml build: DOCKERFILE Compose will use an alternate file to build with. A build path must also be specified. build: context: . dockerfile: Dockerfile-alternate
  • 17. docker-compose.yml build: ARGS Add build arguments, which are environment variables accessible only during the build process. First, specify the arguments in your Dockerfile: ARG buildno ARG password RUN echo "Build number: $buildno" RUN script-requiring-password.sh "$password"
  • 18. docker-compose.yml build: ARGS Then specify the arguments under the build key. You can pass either a mapping or a list: build: context: . args: - buildno=1 - password=secret
  • 19. docker-compose.yml build: command Override the default command. command: bundle exec thin -p 3000 The command can also be a list, in a manner similar to dockerfile: command: [bundle, exec, thin, -p, 3000]
  • 20. Disconnecting containers You can disconnect a container from a network at any time using the docker network disconnect command. Disconnect container1 from the isolated_nw network, then inspect container1 and the isolated_nw network. docker network disconnect isolated_nw container1 docker network inspect isolated_nw
  • 21. Remove a network When all the containers in a network are stopped or disconnected, you can remove a network. If a network has connected endpoints, an error occurs. docker network inspect isolated_nw docker network rm isolated_nw docker network ls
  • 22. Docker Swarm Docker Swarm is the Docker-native solution for deploying a cluster of Docker hosts. You can use it to quickly deploy a cluster of Docker hosts running either on your local machine or on supported cloud platforms.
  • 23. How Swarm nodes works Docker Engine 1.12 introduces swarm mode that enables you to create a cluster of one or more Docker Engines called a swarm. A swarm consists of one or more nodes: physical or virtual machines running Docker Engine 1.12 or later in swarm mode. There are two types of nodes: managers and workers.
  • 24. How services work To deploy an application image when Docker Engine is in swarm mode, you create a service. Frequently a service will be the image for a microservice within the context of some larger application. Examples of services might include an HTTP server, a database, or any other type of executable program that you wish to run in a distributed environment.
  • 25. Create a swarm docker swarm init docker info ...... Swarm: active NodeID: dxn1zf6l61qsb1josjja83ngz Is Manager: true Managers: 1 Nodes: 1 ......
  • 26. Inspect nodes docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS phfku7dign7xvzppcb0i9fzqj * moby Ready Active Leader
  • 27. Add nodes to the swarm docker swarm join-token -q manager docker swarm join --token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-8vxv8rssmk743ojnwacrr2e7c 192.168.99.100:2377
  • 28. Deploy a service to the swarm docker service create --name helloworld --replicas 3 -p 80:80 --network isolated_nw tutum/hello-world docker service create --name bash --network isolated_nw ubuntu docker service ls h3uvf93xt72b bash replicated 1/1 ubuntu:latest tee36wrfs1z8 helloworld replicated 3/3 tutum/hello-world:latest docker exec -it 133e43b35f30 bash apt-get update apt-get install curl curl http://helloworld
  • 29. Inspect a service on the swarm docker service ls docker service inspect --pretty tee36wrfs1z8 docker service ps tee36wrfs1z8
  • 30. Scale the service in the swarm docker service scale <SERVICE-ID>=<NUMBER-OF-TASKS> docker service scale tee36wrfs1z8=4 tee36wrfs1z8rh63c7lkxrfzw scaled to 4
  • 31. Docker-compose.yml features for swarm deploy version: '3' services: redis: image: redis:alpine deploy: replicas: 6 update_config: parallelism: 2 delay: 10s restart_policy: condition: on-failure
  • 32. Docker-compose.yml features for swarm: UPDATE_CONFIG Configures how the service should be updated. Useful for configuring rolling updates. parallelism: The number of containers to update at a time. delay: The time to wait between updating a group of containers. failure_action: What to do if an update fails. One of continue or pause (default: pause). monitor: Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s).
  • 33. Docker-compose.yml features for swarm: UPDATE_CONFIG version: '3' services: vote: image: dockersamples/examplevotingapp_vote:before depends_on: - redis deploy: replicas: 2 update_config: parallelism: 2 delay: 10s
  • 34. Docker-compose.yml features for swarm: RESOURCES Configures resource constraints. version: '3' services: redis: image: redis:alpine deploy: resources: limits: cpus: '0.001' memory: 50M reservations: cpus: '0.0001' memory: 20M
  • 35. Docker-compose.yml features for swarm: RESTART_POLICY Configures if and how to restart containers when they exit. Replaces restart. condition: One of none, on-failure or any (default: any). delay: How long to wait between restart attempts, specified as a duration (default: 0). max_attempts: How many times to attempt to restart a container before giving up (default: never give up). window: How long to wait before deciding if a restart has succeeded, specified as a duration (default: decide immediately).
  • 36. Docker-compose.yml features for swarm: RESTART_POLICY version: "3" services: redis: image: redis:alpine deploy: restart_policy: condition: on-failure delay: 5s max_attempts: 3 window: 120s