5. Challenge In Deploying Microservice
● Centralize Monitoring, Logging and Alerting
● Automation
● Micro-services InterCommunication
6. Docker
➢ Docker is a container based
virtualization technology which are
lightweight and uses host OS.
➢ Provide a uniformed wrapper around a
software package: «Build, Ship and
Run Any App, Anywhere»
➢ You don’t have to pre allocate any
RAM in container.
9. Docker File
A Dockerfile is a text document that contains all the commands a user could call on the
command line to assemble an image.
ADD Copies a file from the host system onto the container
CMD The command that runs when the container starts
ENV Sets an environment variable in the new container
FROM The base image to use in the build. This is mandatory and must be the
first command in the file.
WORKDIR Set the default working directory for the container
$docker build -t ImageName dir
$docker run -d image-name
10. Docker Commands
$ docker images Check available Docker images
$ docker stop container_id Stop running container
$ docker ps List all running container
$ docker exec -it container-id bash Enter into docker container
$ docker rm $(docker ps -a -q) Remove all the running container
$ docker rmi image-name Delete an image
$ docker pull <Name-of-Image> download docker container images from its registry server
$ docker inspect <container-id> List properties of container
11. Docker Networking
● Host : In this mode container will share the host’s network stack and all interfaces from
the host will be available to the container.
● None : This mode will not configure any IP for the container and doesn’t have any
access to the external network as well as for other containers. It does have the
loopback address and can be used for running batch jobs.
● Bridge : Bridge is the Docker default networking mode which will enable the
connectivity to the other interfaces of the host machine as well as among containers.
Host and None mode are not configured directly but default bridge network can be
configured as well as create your own user-defined bridge networks.
Exposing and publishing ports
$ docker run -d -p 9090:8080 my_image
12. Cont..
User-defined networks
Docker does not support automatic service discovery on the default bridge network. If you
want containers to be able to resolve IP addresses by container name, you should use user-
defined networks instead.
$ docker network create mynetwork
$ docker network rm mynetwork
$ docker run --network=mynetwork <container-id>
13. Docker Compose
Compose is a tool for defining and running multi-container Docker applications. With
Compose, you use a YAML file to configure your application’s services. Then, with a single
command, you create and start all the services from your configuration
version: '3'
services:
webapp:
image: examples/web
ports:
- "8000:8000"
networks:
- default
$ docker-compose up
$ docker-compose down
15. References
●
Microservice and Deployment
– IBM Bluemix: The Cloud Platform for Creating and Delivering Applications
●
Docker Networking
―
https://docs.docker.com/engine/userguide/networking/