0% found this document useful (0 votes)
321 views2 pages

Docker Project

This document outlines steps for a Docker mini project, including initializing a Docker swarm, creating services and networks, updating services, adding secrets, and adding constraints. The steps cover initializing a swarm, creating Tomcat and Redis services, updating services, adding an overlay network, creating and using a secret, labeling a node, and deploying a service with constraints.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
321 views2 pages

Docker Project

This document outlines steps for a Docker mini project, including initializing a Docker swarm, creating services and networks, updating services, adding secrets, and adding constraints. The steps cover initializing a swarm, creating Tomcat and Redis services, updating services, adding an overlay network, creating and using a secret, labeling a node, and deploying a service with constraints.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Docker mini project

What you will learn here about Docker

 Docker mini project

Docker mini project


1)Initialize Docker Swarm

docker swarm init

2)Create a docker service with the following details

image: tomcat

name: http

Replicas: 2

port: 80

update-delay: 10s

docker service create --name http --replicas 2 -p 80 --update-delay 10s tomcat

3)Update the above service with a newer image tomcat

docker service update --image tomcat http

4)Scale the above service to 4 replicas

docker service update --replicas=4 http

5)Create a docker overlay network with name app-network

docker network create -d overlay app-network

6)Update http service and add it to app-network network

docker service update --network-add name=app-network http

7)Create a secret with name redis_password and content John@Dow

printf "John@Dow" | docker secret create redis_password -


8)Create another Docker service with following details

image: redis:alpine

name: redis

secret: redis_password

mode: global

docker service create --name redis --secret redis_password --mode global redis:alpine

9)Update the Leader node and add a label color=red

Please Replace <HOSTNAME> With your hostname which is shown below

docker node ls

docker node update --label-add color=red <HOSTANME>

10)Create a docker service with tomcat image with name tomcat-red-only. Add a constraint that the
service will be deployed on node with label color=red

docker service create --name tomcat-red-only --constraint node.labels.color==red tomcat

Source: https://bytesofgigabytes.com/docker/docker-mini-project/

You might also like