https://github.com/pratikshinde55/docker-custom_image
Create Docker Custom Image using "Docker commit "command & "Docker build (Dockerfile)" command
https://github.com/pratikshinde55/docker-custom_image
aws-ec2 docker-build docker-image dockerfile
Last synced: 3 months ago
JSON representation
Create Docker Custom Image using "Docker commit "command & "Docker build (Dockerfile)" command
- Host: GitHub
- URL: https://github.com/pratikshinde55/docker-custom_image
- Owner: Pratikshinde55
- Created: 2024-02-25T12:38:37.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-24T13:25:27.000Z (about 1 year ago)
- Last Synced: 2025-01-13T16:50:35.403Z (about 1 year ago)
- Topics: aws-ec2, docker-build, docker-image, dockerfile
- Homepage:
- Size: 41 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker-Custom_Image
Create Custom image on Docker:

- Purpose of creating Custom image:
When requirement is to create container with lot of custom settings. In container world we share images but not share container.
### There are two ways to Create Custom image using Docker:
1. Docker Commit command
2. Docker Build command (Dockerfile)
## Method:1 -[Custom image by Docker commit command]
In this method of Creating custom image, 1st we launch container & what we want to changes or add anything that on Container, Then create image from precreated container.

Using this "commit" command for create Custom image:
docker commit commitOs1 myos1:v1
Run container from Custom own image(myos1:v1)
docker run -it --name mycontainer myos1:v1

## Method:2 - [Custom image by Dockerfile]
This method of creating Custom image use code(YAML), Creating own image by Code is fully Automatic way.
In this process of creating custom image, We put all code in one file that is "Dockerfile"
docker build -t myOwnimage:v1 .
& we also put code in custom name file but at Building image time we need to mention File name & path / directory
docker build -t myOwnimage:v1 -f myYmlcode /mycodefolder/
" -t " --> To Declare name to custom image(tag).
" -f " --> Name of file where code kept(file).
" . " --> Current directory.
- Note:
In code when use interactive command then need to pass argument. example: yum install httpd -y
"FORM" is a keyword in code file to tell about base image.(from base image we create new image)
"RUN" is keyword in code file for running commands.
Use commad to build image from Code(Dockerfile):
docker build -t myimage:v1 .
Running container from own custom image(myimage:v1):
docker run -it --name myos1 myimage:v1
