Showing posts with label Docker. Show all posts
Showing posts with label Docker. Show all posts

Sunday, May 9, 2021

Dockerfile

Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image

The Docker build command executes the Dockerfile and builds a Docker image from it.

 A Docker image typically consists of:

  • A base Docker image on top of which to build your own Docker image.
  • A set of tools and applications to be installed in the Docker image.
  • A set of files to be copied into the Docker image (e.g configuration files).
  • Possibly a network (TCP / UDP) port (or more) to be opened for traffic in the firewall..etc

Dockerfile Structure

A Dockerfile consists of a set of instructions. Each instruction consists of a command followed by arguments to that command, similar to command line executables. 

Here is a simple example of a Dockerfile:

# The base image

FROM ubuntu:latest

# More instructions here that install software and copy files into the image.

COPY    /myapp/target/myapp.jar    /myapp/sriniapp.jar

# The command executed when running a Docker container based on this image.

CMD echo Starting Docker Container

Refer: https://www.youtube.com/watch?v=QLENvSMSD-0

Thursday, July 2, 2020

Deploy Spring Boot with Docker into AWS EC2

In this Post,we will be starting AWS EC2 instance and deploying the microservices on them using Docker.



Sample App can be found under below link: https://github.com/srinivastraining/Boot-docker

Friday, June 26, 2020

Docker on 32-bit Windows

Docker is a set of platform as a service (PaaS)that uses OS-level virtualization to deliver software in packages called containers.
Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.
Docker allows applications to use the same Linux kernel as the system that they're running on and only requires applications be shipped with things not already running on the host computer.
For some reason, Docker really doesn’t want people to run on 32-bit.
Below are the steps.
  • Download choco from below link:https://chocolatey.org/docs/installation
  • Once installed,issue below steps.
  • choco install docker-machine -y
  • docker-machine create --driver virtualbox default
  • docker-machine env | Invoke-Expression
That’s it! You can verify that it’s working correctly by running “docker version”:
PS C:\Windows\system32> docker version
Client:
 Version: 1.12.1
 API version: 1.24
 Go version: go1.6.3
 Git commit: 23cf638
 Built: Thu July 18 17:52:38 2021
 OS/Arch: windows/386

Monday, June 1, 2020

Docker Swarm

Docker Swarm is a group of either physical or virtual machines that are running the Docker application and that have been configured to join together in a cluster. Once a group of machines have been clustered together, you can still run the Docker commands that you're used to, but they will now be carried out by the machines in your cluster.

The activities of the cluster are controlled by a swarm manager, and machines that have joined the cluster are referred to as nodes.

Docker swarm is a container orchestration tool, meaning that it allows the user to manage multiple containers deployed across multiple host machines.

The cluster management and orchestration features embedded in the Docker Engine are built using Swarmkit. 

A Node is an instance of the Docker engine participating in the swarm. 

Worker Nodes receive and execute tasks dispatched from manager nodes. By default manager nodes also run services as worker nodes, but you can configure them to run manager tasks exclusively and be manager-only nodes. 

Manager nodes  perform the orchestration and cluster management functions required to maintain the desired state of the swarm. 

The swarm manager can automatically assign the service a PublishedPort or you can configure a PublishedPort for the service.

A Service is the definition of tasks to execute on the manager or worker nodes. It is the central structure of the swarm system and the primary root of user interaction with the swarm.

Node Management:

  • Initialize a swarm: docker swarm init
  • List swarm nodes: docker node ls

Activate a node (after maintenance): 

docker node update --availability active node_name

Service management:

  • List services (manager node): docker service ls
  • Describe services (manager node): docker service ps service_name
  • Inspect a service: docker service inspect service_name
  • Scale a service: docker service scale service_name=N
  • Remove service: docker service rm service_name

Stack management

  • Deploy stack from docker-compose file: docker stack deploy -c docker-compose.yml stack_name
  • List stacks: docker stack ls
  • List stack services: docker stack services stack_name
  • List stack tasks: docker stack ps stack_name
  • Remove stack : docker stack rm stack_name

Network management:

  • List networks: docker network ls
  • Create overlay network: docker network create -d overlay network_name
  • Remove network: docker network rm network_name

Monitor services

  • Docker stats: docker stats
  • Service logs: docker service logs service_name

ES12 new Features