Docker Tutorial

  • Docker is a centralized platform for packaging, deploying, and running applications. Before Docker, many users face the problem that a particular code is running in the developer's system but not in the user's system. So, the main reason to develop docker is to help developers to develop applications easily, ship them into containers, and can be deployed anywhere.

  • Docker was firstly released in March 2013. It is used in the Deployment stage of the software development life cycle that's why it can efficiently resolve issues related to the application deployment.

Verify Docker Engine

docker --version

Docker Engine Work

docker info

Docker image How to download

docker pull image--name

Docker image How to Show

docker images

Docker run

docker run image--name

How to running Containers See comment

docker ps

How to All Containers See comment

docker ps -a

Docker file in projects

#use a base image
FROM alpine:lateast

#run a comment
CMD ["echo","Hello,Docker"]

Build Docker

docker build -t my-simple-image .

Docker node pull

docker pull node

Docker node run

docker run node

Docker container start

docker start container_name

Already Docker container start not stoped comment

docker exec -it container_name node

(or) Already Docker container start not stoped comment Path way

docker exec -it container_name /bin/bash

cd /usr/localbin/bin

node

Containers Name create

docker run --name node_imagename node_containername

Containers ReName create

docker rename node_imagename newnode_imagename 

Containers not running containers all deleted

docker container prune

Copy file to container

  • my_sample.txt file to create a file
docker pull alpine

docker run -it --name my_alpina_container

ls

not stoping this comment new open terminal

current working txt file path open terminal

docker cp .\my_example.txt  container_name:/example.txt
docker cp .\my_example.txt  container_name:/var/example.txt

copy to the file conatiner name var path inside

Read file

cat example.txt

Copy file from container

docker cp container__name:/file_name.txt ./exmple_copy.txt

publishing Docker images

  • Dockerfile create a file name
FROM alpine:lateast
CMD echo "Hello,Docker"

open terminal

docker build -t image_name . 

The next step to a DockerHub to publish

  • Repositories
  • create Repositories
  • repo name & descrption
  • public
  • create
docker login




docker tag my-simple-image  selvalr/my-simple-image-repo:latest


docker push selvalr/my-simple-image-repo:latest

pulling & Run DockerHub images

first delete the docker image to a your already pushing a data in docler container

docker pull selvalr/my-simple-image-repo:latest


docker run -it selvalr/my-simple-image-repo