Blog : 02 How to Create Container from Docker 
                   Hub Image ,Creating Image from Container

Blog : 02 How to Create Container from Docker Hub Image ,Creating Image from Container

·

2 min read

  • How to Create image from container

  • How to Create Container from Docker Hub Image

Docker Defenition

Docker is an open source software platform to create, deploy and manage virtualized application containers on a common operating system (OS), with an ecosystem of allied tools. Docker container technology debuted in 2013; Docker Inc. was formed to support a commercial edition of container management software and be the principal sponsor of an open source version. Mirantis acquired the Docker Enterprise business in November 2019.

Container

containerization is an approach to software development in which an application or service, its dependencies, and its configuration (abstracted as deployment manifest files) are packaged together as a container image

  • Step to Create Container from Image and

  • Create Image from Update Container

Update System

apt-get update

Docker Install

apt-get install docker -y

Docker status

service docker status

docker search <image_name>

Pull Images from DockerHub

docker pull <image_name>

To See all Images

docker images

To Detele Image

docker rmi <image_name>

Create Container From Image

docker run -it --name <container_name> <image_name> /bin/bash

To Cheak all Container

docker ps -a

To Cheak Only Running Container

docker ps

To Delete Container

docker rm <container_id>
docker rm <container_name>

To Stop Running Container

docker stop <container_name>
docker stop <container_Id>

To Start Stoped Container

docker start <container_name>
docker start <container_Id>

To Go Inside Container

docker attach <container_name>
docker attach <container_id>

  1. Now Creating Images from Container

First change into any container

changes in container_2

creating dir aman in var

Dir aman Inside Creating File ravi

  1. Now Creating images from container and check changes

     docker commit <container_name> <new_image_name>
    

    now check Images

     docker image
    

now again creating container from new image

docker run -td --name <new_conatiner_name> <new_image_name> /bin/bash

check container created or not ?

docker ps -a