Kubernetes Day 2 Practicals

There are 3 ways to run docker container

  • f8e ground
  • Back ground – Detached / Daemon
  • Interactive

f8e ground

docker run nginx

docker run is a command to create new container out of an Existing Image.

Below is the container stopped containers

$ docker ps -a

Background

docker run -d nginx

Interactive

docker run -it alpine sh

To check the os with in a ubuntu container

Exec in to the container and run below command :

$ cat /etc/os-releases

To come out of a container

$ ctrl + PQ

To clear all the containers (Run this command responsibly)

$ docker rm -f `docker ps -aq`

Below is the command to know any object in container / Image in container :

$ docker inspect <Container_ID>

Below is the command to stop container

$ docker stop <Container_ID>

Below is the command to start container

$ docker start <Container_ID>

To show utilisation of a container

$ docker stats

To come out of all the containers

ctrl + c

To check the space occupied by all the containers

$ docker ps -S

To delete containers permanently

$ docker rm -f <container_Id>

To check the utilisation of docker on our system

$ docker system df

To delete all the stopped containers (Run this command responsibly)

$ docker container prune

To show list of all the containers on our system

$ docker ps -aq

Image is a set of read only layers, we can not update image once it is created.

We can run container using the image and edit with in the container.

Using one image we can run “N” number of containers.

To run ubuntu operating system in a container and enter in to it

$ docker pull ubuntu:16.04

$ docker run -it ubuntu:16:04 bash

Exec in to container and run below command to update.

$ apt-get update

To convert container as new Image

$ docker commit -m “This is MFH Image” <container_id>

To identify the images which are not part of any repository & tag

$ docker images -f dangling=true

Container Orchestration Tools :

  • Amazon EKS (Elastic Kubernetes Service)
  • Azure Kubernetes Service (AKS)
  • Docker Swarm
  • Google Kubernetes Engine from GCP
  • Kubernetes
  • C8eos from COREOS
  • Mesosphere marathon from DCOS / Marathon
  • Cloud foundry’s Diego from Cloud foundry

MFH DevOps Consultation Services

Add Few lines about the company here

Contact

MFH Devops Consulation
#4-72-1/1. 1st Floor, Beach Road Lawson’s Bay Colony, Near Shanti Ashram, Opp. Bharat Petroleum, Visakhapatnam, Andhra Pradesh – 530017