Showing posts with label docker. Show all posts
Showing posts with label docker. Show all posts

Tuesday, February 21, 2023

Advantages of Containerization | Docker

 Containerization provides several advantages over traditional approaches to software deployment:

  1. Portability: Containers are designed to be portable, which means that applications can be easily moved between different environments, from development to production, and across different infrastructure platforms, including on-premises and cloud-based environments.

  2. Consistency: Containers provide a consistent environment in which an application can run, which reduces the likelihood of deployment errors caused by differences in underlying infrastructure. This also simplifies the process of troubleshooting and debugging.

  3. Resource efficiency: Containers share the same underlying operating system, which means that they require less resources than traditional virtual machines, resulting in improved resource efficiency.

  4. Scalability: Containers can be easily scaled up or down to meet changes in demand, which makes them an ideal solution for applications with variable workloads.

  5. Security: Containers can provide a more secure environment than traditional deployment methods because they are isolated from each other and from the host system.

  6. Faster development and deployment: Containers allow developers to package and deploy their applications quickly and easily, which enables faster iteration and delivery of new features.

  7. Reduced dependency conflicts: Containers are designed to isolate applications and their dependencies from one another, which means that applications can be developed and deployed without conflict or interference from other applications.

Overall, containerization can simplify the process of deploying, scaling, and managing applications, while also reducing resource usage and improving security.

Sunday, June 28, 2020

Docker Compose Cheat Sheet || Docker Captain || Astute JS

# Making It Easier with Docker Compose: The Multi-Container Tool

## Docker Compose and The Docker-compose.yml File

docker-compose.yml

https://docs.docker.com

## Trying Out Basic Compose Commands

pcat docker-compose.yml

docker-compose up

docker-compose up -d

docker-compose logs

docker-compose --help

docker-compose ps

docker-compose top

docker-compose down

## Assignment Answers: Build a Compose File for a Multi-Container Service

docker-compose.yml

docker pull drupal

docker image inspect drupal

docker-compose up

https://hub.docker.com

docker-compose down --help

docker-compose down -v

## Adding Image Building to Compose Files

docker-compose.yml

docker-compose up

docker-compose up --build

docker-compose down

docker image ls

docker-compose down --help

docker image rm nginx-custom

docker image ls

docker-compose up -d

docker image ls

docker-compose down --help

docker-compose down --rmi local

## Assignment Answers: Compose for Run-Time Image Building and Multi-Container Dev

docker-compose up

docker-compose down

docker-compose up


version: '3.3'

services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: somewordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "8000:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
       WORDPRESS_DB_NAME: wordpress
volumes:
    db_data: {}

Saturday, June 27, 2020

Docker Volume commands || Cheatsheet || Astute JS

# Container Lifetime & Persistent Data: Volumes, Volumes, Volumes

## Persistent Data: Data Volumes

docker pull mysql

docker image inspect mysql

docker container run -d --name mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=True mysql

docker container ls

docker container inspect mysql

docker volume ls

docker volume inspect TAB COMPLETION

docker container run -d --name2 mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=True mysql

docker volume ls

docker container stop mysql

docker container stop mysql2

docker container ls

docker container ls -a

docker volume ls

docker container rm mysql mysql2

docker volume ls

docker container run -d --name mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=True -v mysql-db:/var/lib/mysql mysql

docker volume ls

docker volume inspect mysql-db

docker container rm -f mysql

docker container run -d --name mysql3 -e MYSQL_ALLOW_EMPTY_PASSWORD=True -v mysql-db:/var/lib/mysql mysql

docker volume ls

docker container inspect mysql3

docker volume create --help

## Persistent Data: Bind Mounting

cd dockerfile-sample-2

pcat Dockerfile

docker container run -d --name nginx -p 80:80 -v $(pwd):/usr/share/nginx/html nginx

docker container run -d --name nginx2 -p 8080:80 nginx

docker container exec -it nginx bash

## Assignment Answers: Edit Code Running In Containers With Bind Mounts

docker run -p 80:4000 -v $(pwd):/site bretfisher/jekyll-serve


The what and why of Docker - Towards Data Science

Docker Popular Image Commands || Cheatsheet || Astute Js

# Container Images, Where To Find Them and How To Build Them

## The Mighty Hub: Using Docker Hub Registry Images

http://hub.docker.com

docker image ls

docker pull nginx

docker pull nginx:1.11.9

docker pull nginx:1.11

docker pull nginx:1.11.9-alpine

docker image ls

## Images and Their Layers: Discover the Image Cache

docker image ls

docker history nginx:latest

docker history mysql

docker image inspect nginx

The what and why of Docker - Towards Data Science

## Image Tagging and Pushing to Docker Hub

docker image tag -- help

docker image ls

docker pull mysql/mysql-server

docker image ls

docker pull nginx:mainline

docker image ls

docker image tag nginx sathishkrcs/nginx

docker image tag --help

docker image ls

docker image push sathishkrcs/nginx

docker --help

docker login

cat .docker/config.json

docker image push sathishkrcs/nginx

docker image push sathishkrcs/nginx sathishkrcs/nginx:testing

docker image ls

docker image push sathishkrcs/nginx:testing

docker image ls

## Building Images: The Dockerfile Basics

cd dockerfile-sample-1

vim Dockerfile

## Building Images: Running Docker Builds

docker image build -t customnginx .

docker image ls

docker image build -t customnginx .

## Building Images: Extending Official Images

cd dockerfile-sample-2

vim Dockerfile

docker container run -p 80:80 --rm nginx

docker image build -t nginx-with-html .

docker container run -p 80:80 --rm nginx-with-html

docker image ls

docker image tag --help

docker image tag nginx-with-html:latest sathishkrcs/nginx-with-html:latest

docker image ls

docker push

## Assignment Answers: Build Your Own Dockerfile and Run Containers From It

cd dockerfile-assignment-1

vim Dockerfile

docker build cmd

docker build -t testnode .

docker container run --rm -p 80:3000 testnode

docker images

docker tag --help

docker tag testnode sathishkrcs/testing-node

docker push --help

docker push sathishkrcs/testing-node

docker image ls

docker image rm sathishkrcs/testing-node

docker container run --rm -p 80:3000 sathishkrcs/testing-node

Saturday, June 13, 2020

Docker remove Unused Objects | Containers, Images, Tags and Networks

Docker is isolated containers from the base operating system , But docker runs lightweight operating system on each container which eventually consumes more disk space.

In order to use the system efficiently, Docker memory management becomes more significant. Here is the command to delete docker unused components and helps to revoke significant disk space  .


$ docker system prune


Image result for docker

Serverless vs. Kubernetes: A Beginner's Guide

Serverless vs. Kubernetes: A Beginner's Guide Trying to decide between serverless and Kubernetes? Here's a simple breakdown: 🔹 Choo...