SlideShare a Scribd company logo
Docker file
➢ Docker Image:
A Docker Image is a read-only file with a bunch of instructions. When these instructions are executed, it
creates a Docker container.
➢ Dockerfile:
Dockerfile is a simple text file that consists of instructions to build Docker images.
➢ Syntax
# comments
command argument argument1...
➢ Docker Commands for Creating a Dockerfile
CMD - Specifies what command to run within the container
FROM - Creates a layer from the ubuntu:18.04
FROM ubuntu:18.04
PULL - Adds files from your Docker repository
PULL. /file
RUN - Builds your container
RUN make /file
CMD python /file/file.py
• allows specifying a command along with the parameters
• Syntax, ENTRYPOINT application "arg, arg1".
• Example , ENTRYPOINT echo "Hello, $name".
ENTRYPOINT
• ADD command helps in copying data into a Docker image
• Syntax , ADD /[source]/[destination]
• Example , ADD /root_folder/test_folder
ADD
• ENV provides default values for variables that can be accessed within the container
• Syntax , ENV key value
• Example , ENV value_1
ENV
• MAINTAINER declares the author field of the images
• Syntax , MAINTAINER [name]
• Example , MAINTAINER author_name
MAINTAINER
Docker Commands
network Manage networks
volume Manage volumes
Name Description
attach Attach local standard input, output, and error streams to a running container
build Build an image from a Dockerfile
commit Create a new image from a container’s changes
config Manage Swarm configs
container Manage containers
cp Copy files/folders between a container and the local filesystem
create Create a new container
exec Execute a command in a running container
export Export a container’s filesystem as a tar archive
image Manage images
images List images
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
port List port mappings or a specific mapping for the container
ps List containers
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
rmi Remove one or more images
run Create and run a new container from an image
save
Save one or more images to a tar archive (streamed to STDOUT by
default)
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
top Display the running processes of a container
Build a Docker Image with Dockerfile
➢ Create a directory where the dockerfile will be stored.
▪ mkdir c1 && cd c1
➢ Create dockerfile
▪ sudo vi dockerfile
####Contents of Dockerfile####
FROM ubuntu:22.04
MAINTAINER Virtual_University_of_Pakistan
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y ubuntu-server
EXPOSE 2022
#expose the port 2022
CMD ["echo", "Welcome to it601p"]
#above command will print the message and container will exit.
#To keep it running run bash and keep it running
CMD [“PROGRAM_TO_RUN”]
Build a Docker Image with Dockerfile
➢ Build the image using above docker file
▪ docker build --help
▪ docker build <options>
Option Description
--build-arg Set build-time variables
--cache-from Images to consider as cache sources
--cgroup-parent Optional parent cgroup for the container
--compress Compress the build context using gzip
--cpu-period Limit CPU CFS (Completely Fair Scheduler) period
--cpu-quota Limit the CPU CFS (Completely Fair Scheduler) quota
--cpu-shares , -c CPU shares (relative weight)
--cpuset-cpus CPUs in which to allow execution (0-3, 0,1)
--cpuset-mems MEMs in which to allow execution (0-3, 0,1)
--disable-content-trust TRUE, Skip image verification
--iidfile Write the image ID to the file
--isolation Container isolation technology
--memory , -m Memory limit
--memory-swap
Swap limit equal to memory plus swap: -1 to enable unlimited
swap
--no-cache Do not use cache when building the image
--platform Set platform if server is multi-platform capable
--pull Always attempt to pull a newer version of the image
--security-opt Security options
--shm-size Size of /dev/shm
--squash Squash newly built layers into a single new layer
--target Set the target build stage to build.
--ulimit Ulimit options
➢ Some Options
--file, -f : docker file name
--label : set meta data for image
--quite -q : suppress output
--rm : Remove intermediate containers
--tag, -t : set name or tag
--add-host : Add custom host to IP mapping
--network : set the networking mode for run commands
➢ Upon completion , it returns the image id
Build a Docker Image with Dockerfile
➢ Verify the image is crated
▪ docker images
➢ Run an image
▪ docker run name:tag <options>
--workdir , -w Working directory inside the container
--hostname , -h Container host name
--interactive , -i Keep STDIN open even if not attached
--ip IPv4 address (e.g., 172.30.100.104)
--label , -l Set meta data on a container
--link Add link to another container
--mount Attach a filesystem mount to the container
--name Assign a name to the container
--network Connect a container to a network
--rm Automatically remove the container when it exits
--mac-address Container MAC address (e.g., 92:d0:c6:0a:29:33)
--memory , -m Memory limit
--volume , -v Bind mount a volume
Create a New Container
Now, create a Docker container from the Docker image we created in the previous step.
docker run --name it601p_m1
Ad

More Related Content

Similar to Computer science docker file Week -6 to7 (20)

Docker use dockerfile
Docker use dockerfileDocker use dockerfile
Docker use dockerfile
cawamata
 
Docker 101
Docker 101Docker 101
Docker 101
schmidtbt
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
Kuan Yen Heng
 
Docker
DockerDocker
Docker
Dmitry Bolgarov
 
Docker, but what it is?
Docker, but what it is?Docker, but what it is?
Docker, but what it is?
Julien Maitrehenry
 
Clouds and Tools: Cheat Sheets & Infographics
Clouds and Tools: Cheat Sheets & InfographicsClouds and Tools: Cheat Sheets & Infographics
Clouds and Tools: Cheat Sheets & Infographics
Thomas Poetter
 
Primi passi con Docker - ItalianCoders - 12-01-2021
Primi passi con Docker - ItalianCoders - 12-01-2021Primi passi con Docker - ItalianCoders - 12-01-2021
Primi passi con Docker - ItalianCoders - 12-01-2021
Alessandro Mignogna
 
Docker Compose user guide
Docker Compose user guideDocker Compose user guide
Docker Compose user guide
VAIBHAV GUPTA
 
DockerSADASDASDA SADASDASDASDASDASDLabs.pptx
DockerSADASDASDA SADASDASDASDASDASDLabs.pptxDockerSADASDASDA SADASDASDASDASDASDLabs.pptx
DockerSADASDASDA SADASDASDASDASDASDLabs.pptx
MuhamedAhmed35
 
dockerizing web application
dockerizing web applicationdockerizing web application
dockerizing web application
Walid Ashraf
 
Docker and the Container Ecosystem
Docker and the Container EcosystemDocker and the Container Ecosystem
Docker and the Container Ecosystem
psconnolly
 
How to write a Dockerfile
How to write a DockerfileHow to write a Dockerfile
How to write a Dockerfile
Knoldus Inc.
 
Hands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbiesHands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbies
Yigal Elefant
 
Docker.pdf
Docker.pdfDocker.pdf
Docker.pdf
UsamaMushtaq24
 
Docker
DockerDocker
Docker
Mutlu Okuducu
 
Docker Up and Running Introduction
Docker Up and Running IntroductionDocker Up and Running Introduction
Docker Up and Running Introduction
Mark Beacom
 
Learn enough Docker to be dangerous
Learn enough Docker to be dangerousLearn enough Docker to be dangerous
Learn enough Docker to be dangerous
David Tan
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
Binary Studio
 
Docker slides
Docker slidesDocker slides
Docker slides
Ayla Khan
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
Runcy Oommen
 
Docker use dockerfile
Docker use dockerfileDocker use dockerfile
Docker use dockerfile
cawamata
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
Kuan Yen Heng
 
Clouds and Tools: Cheat Sheets & Infographics
Clouds and Tools: Cheat Sheets & InfographicsClouds and Tools: Cheat Sheets & Infographics
Clouds and Tools: Cheat Sheets & Infographics
Thomas Poetter
 
Primi passi con Docker - ItalianCoders - 12-01-2021
Primi passi con Docker - ItalianCoders - 12-01-2021Primi passi con Docker - ItalianCoders - 12-01-2021
Primi passi con Docker - ItalianCoders - 12-01-2021
Alessandro Mignogna
 
Docker Compose user guide
Docker Compose user guideDocker Compose user guide
Docker Compose user guide
VAIBHAV GUPTA
 
DockerSADASDASDA SADASDASDASDASDASDLabs.pptx
DockerSADASDASDA SADASDASDASDASDASDLabs.pptxDockerSADASDASDA SADASDASDASDASDASDLabs.pptx
DockerSADASDASDA SADASDASDASDASDASDLabs.pptx
MuhamedAhmed35
 
dockerizing web application
dockerizing web applicationdockerizing web application
dockerizing web application
Walid Ashraf
 
Docker and the Container Ecosystem
Docker and the Container EcosystemDocker and the Container Ecosystem
Docker and the Container Ecosystem
psconnolly
 
How to write a Dockerfile
How to write a DockerfileHow to write a Dockerfile
How to write a Dockerfile
Knoldus Inc.
 
Hands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbiesHands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbies
Yigal Elefant
 
Docker Up and Running Introduction
Docker Up and Running IntroductionDocker Up and Running Introduction
Docker Up and Running Introduction
Mark Beacom
 
Learn enough Docker to be dangerous
Learn enough Docker to be dangerousLearn enough Docker to be dangerous
Learn enough Docker to be dangerous
David Tan
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
Binary Studio
 
Docker slides
Docker slidesDocker slides
Docker slides
Ayla Khan
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
Runcy Oommen
 

Recently uploaded (20)

Lecture 12 Types of farming system
Lecture 12       Types of farming systemLecture 12       Types of farming system
Lecture 12 Types of farming system
Nickala1
 
UNIT chromatography instrumental6 .pptx
UNIT chromatography  instrumental6 .pptxUNIT chromatography  instrumental6 .pptx
UNIT chromatography instrumental6 .pptx
myselfit143
 
Skin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _ControlSkin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _Control
muralinath2
 
Zoonosis, Types, Causes. A comprehensive pptx
Zoonosis, Types, Causes. A comprehensive pptxZoonosis, Types, Causes. A comprehensive pptx
Zoonosis, Types, Causes. A comprehensive pptx
Dr Showkat Ahmad Wani
 
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Himarsha Jayanetti
 
SuperconductingMagneticEnergyStorage.pptx
SuperconductingMagneticEnergyStorage.pptxSuperconductingMagneticEnergyStorage.pptx
SuperconductingMagneticEnergyStorage.pptx
BurkanAlpKale
 
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
ss0077014
 
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
muralinath2
 
APES 6.5 Presentation Fossil Fuels .pdf
APES 6.5 Presentation Fossil Fuels   .pdfAPES 6.5 Presentation Fossil Fuels   .pdf
APES 6.5 Presentation Fossil Fuels .pdf
patelereftu
 
Preparation of Permanent mounts of Parasitic Protozoans.pptx
Preparation of Permanent mounts of Parasitic Protozoans.pptxPreparation of Permanent mounts of Parasitic Protozoans.pptx
Preparation of Permanent mounts of Parasitic Protozoans.pptx
Dr Showkat Ahmad Wani
 
Presentatation_SM_muscle_structpes_funtionre_ty.pptx
Presentatation_SM_muscle_structpes_funtionre_ty.pptxPresentatation_SM_muscle_structpes_funtionre_ty.pptx
Presentatation_SM_muscle_structpes_funtionre_ty.pptx
muralinath2
 
Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...
Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...
Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...
Yasasi Abeysinghe
 
Botany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdf
Botany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdfBotany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdf
Botany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdf
JseleBurgos
 
Polymerase Chain Reaction (PCR).Poer Pint
Polymerase Chain Reaction (PCR).Poer PintPolymerase Chain Reaction (PCR).Poer Pint
Polymerase Chain Reaction (PCR).Poer Pint
Dr Showkat Ahmad Wani
 
when is CT scan need in breast cancer patient.pptx
when is CT scan need in breast cancer patient.pptxwhen is CT scan need in breast cancer patient.pptx
when is CT scan need in breast cancer patient.pptx
Rukhnuddin Al-daudar
 
Parallel resonance circuits of science.pdf
Parallel resonance circuits of science.pdfParallel resonance circuits of science.pdf
Parallel resonance circuits of science.pdf
rk5867336912
 
Skin function_protective_absorptive_Presentatation.pptx
Skin function_protective_absorptive_Presentatation.pptxSkin function_protective_absorptive_Presentatation.pptx
Skin function_protective_absorptive_Presentatation.pptx
muralinath2
 
Quiz 3 Basic Nutrition 1ST Yearcmcmc.pptx
Quiz 3 Basic Nutrition 1ST Yearcmcmc.pptxQuiz 3 Basic Nutrition 1ST Yearcmcmc.pptx
Quiz 3 Basic Nutrition 1ST Yearcmcmc.pptx
NutriGen
 
RAPID DIAGNOSTIC TEST (RDT) overviewppt.pptx
RAPID DIAGNOSTIC TEST (RDT)  overviewppt.pptxRAPID DIAGNOSTIC TEST (RDT)  overviewppt.pptx
RAPID DIAGNOSTIC TEST (RDT) overviewppt.pptx
nietakam
 
Polytene chromosomes. A Practical Lecture.pptx
Polytene chromosomes. A Practical Lecture.pptxPolytene chromosomes. A Practical Lecture.pptx
Polytene chromosomes. A Practical Lecture.pptx
Dr Showkat Ahmad Wani
 
Lecture 12 Types of farming system
Lecture 12       Types of farming systemLecture 12       Types of farming system
Lecture 12 Types of farming system
Nickala1
 
UNIT chromatography instrumental6 .pptx
UNIT chromatography  instrumental6 .pptxUNIT chromatography  instrumental6 .pptx
UNIT chromatography instrumental6 .pptx
myselfit143
 
Skin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _ControlSkin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _Control
muralinath2
 
Zoonosis, Types, Causes. A comprehensive pptx
Zoonosis, Types, Causes. A comprehensive pptxZoonosis, Types, Causes. A comprehensive pptx
Zoonosis, Types, Causes. A comprehensive pptx
Dr Showkat Ahmad Wani
 
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Himarsha Jayanetti
 
SuperconductingMagneticEnergyStorage.pptx
SuperconductingMagneticEnergyStorage.pptxSuperconductingMagneticEnergyStorage.pptx
SuperconductingMagneticEnergyStorage.pptx
BurkanAlpKale
 
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
ss0077014
 
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
Body temperature_chemical thermogenesis_hypothermia_hypothermiaMetabolic acti...
muralinath2
 
APES 6.5 Presentation Fossil Fuels .pdf
APES 6.5 Presentation Fossil Fuels   .pdfAPES 6.5 Presentation Fossil Fuels   .pdf
APES 6.5 Presentation Fossil Fuels .pdf
patelereftu
 
Preparation of Permanent mounts of Parasitic Protozoans.pptx
Preparation of Permanent mounts of Parasitic Protozoans.pptxPreparation of Permanent mounts of Parasitic Protozoans.pptx
Preparation of Permanent mounts of Parasitic Protozoans.pptx
Dr Showkat Ahmad Wani
 
Presentatation_SM_muscle_structpes_funtionre_ty.pptx
Presentatation_SM_muscle_structpes_funtionre_ty.pptxPresentatation_SM_muscle_structpes_funtionre_ty.pptx
Presentatation_SM_muscle_structpes_funtionre_ty.pptx
muralinath2
 
Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...
Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...
Examining Visual Attention in Gaze-Driven VR Learning: An Eye-Tracking Study ...
Yasasi Abeysinghe
 
Botany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdf
Botany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdfBotany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdf
Botany-Finals-Patterns-of-Inheritance-DNA-Synthesis.pdf
JseleBurgos
 
Polymerase Chain Reaction (PCR).Poer Pint
Polymerase Chain Reaction (PCR).Poer PintPolymerase Chain Reaction (PCR).Poer Pint
Polymerase Chain Reaction (PCR).Poer Pint
Dr Showkat Ahmad Wani
 
when is CT scan need in breast cancer patient.pptx
when is CT scan need in breast cancer patient.pptxwhen is CT scan need in breast cancer patient.pptx
when is CT scan need in breast cancer patient.pptx
Rukhnuddin Al-daudar
 
Parallel resonance circuits of science.pdf
Parallel resonance circuits of science.pdfParallel resonance circuits of science.pdf
Parallel resonance circuits of science.pdf
rk5867336912
 
Skin function_protective_absorptive_Presentatation.pptx
Skin function_protective_absorptive_Presentatation.pptxSkin function_protective_absorptive_Presentatation.pptx
Skin function_protective_absorptive_Presentatation.pptx
muralinath2
 
Quiz 3 Basic Nutrition 1ST Yearcmcmc.pptx
Quiz 3 Basic Nutrition 1ST Yearcmcmc.pptxQuiz 3 Basic Nutrition 1ST Yearcmcmc.pptx
Quiz 3 Basic Nutrition 1ST Yearcmcmc.pptx
NutriGen
 
RAPID DIAGNOSTIC TEST (RDT) overviewppt.pptx
RAPID DIAGNOSTIC TEST (RDT)  overviewppt.pptxRAPID DIAGNOSTIC TEST (RDT)  overviewppt.pptx
RAPID DIAGNOSTIC TEST (RDT) overviewppt.pptx
nietakam
 
Polytene chromosomes. A Practical Lecture.pptx
Polytene chromosomes. A Practical Lecture.pptxPolytene chromosomes. A Practical Lecture.pptx
Polytene chromosomes. A Practical Lecture.pptx
Dr Showkat Ahmad Wani
 
Ad

Computer science docker file Week -6 to7

  • 1. Docker file ➢ Docker Image: A Docker Image is a read-only file with a bunch of instructions. When these instructions are executed, it creates a Docker container. ➢ Dockerfile: Dockerfile is a simple text file that consists of instructions to build Docker images. ➢ Syntax # comments command argument argument1... ➢ Docker Commands for Creating a Dockerfile CMD - Specifies what command to run within the container FROM - Creates a layer from the ubuntu:18.04 FROM ubuntu:18.04 PULL - Adds files from your Docker repository PULL. /file RUN - Builds your container RUN make /file CMD python /file/file.py
  • 2. • allows specifying a command along with the parameters • Syntax, ENTRYPOINT application "arg, arg1". • Example , ENTRYPOINT echo "Hello, $name". ENTRYPOINT • ADD command helps in copying data into a Docker image • Syntax , ADD /[source]/[destination] • Example , ADD /root_folder/test_folder ADD • ENV provides default values for variables that can be accessed within the container • Syntax , ENV key value • Example , ENV value_1 ENV • MAINTAINER declares the author field of the images • Syntax , MAINTAINER [name] • Example , MAINTAINER author_name MAINTAINER
  • 3. Docker Commands network Manage networks volume Manage volumes Name Description attach Attach local standard input, output, and error streams to a running container build Build an image from a Dockerfile commit Create a new image from a container’s changes config Manage Swarm configs container Manage containers cp Copy files/folders between a container and the local filesystem create Create a new container exec Execute a command in a running container export Export a container’s filesystem as a tar archive image Manage images images List images inspect Return low-level information on Docker objects kill Kill one or more running containers load Load an image from a tar archive or STDIN port List port mappings or a specific mapping for the container ps List containers rename Rename a container restart Restart one or more containers rm Remove one or more containers rmi Remove one or more images run Create and run a new container from an image save Save one or more images to a tar archive (streamed to STDOUT by default) stats Display a live stream of container(s) resource usage statistics stop Stop one or more running containers top Display the running processes of a container
  • 4. Build a Docker Image with Dockerfile ➢ Create a directory where the dockerfile will be stored. ▪ mkdir c1 && cd c1 ➢ Create dockerfile ▪ sudo vi dockerfile ####Contents of Dockerfile#### FROM ubuntu:22.04 MAINTAINER Virtual_University_of_Pakistan ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get install -y ubuntu-server EXPOSE 2022 #expose the port 2022 CMD ["echo", "Welcome to it601p"] #above command will print the message and container will exit. #To keep it running run bash and keep it running CMD [“PROGRAM_TO_RUN”]
  • 5. Build a Docker Image with Dockerfile ➢ Build the image using above docker file ▪ docker build --help ▪ docker build <options> Option Description --build-arg Set build-time variables --cache-from Images to consider as cache sources --cgroup-parent Optional parent cgroup for the container --compress Compress the build context using gzip --cpu-period Limit CPU CFS (Completely Fair Scheduler) period --cpu-quota Limit the CPU CFS (Completely Fair Scheduler) quota --cpu-shares , -c CPU shares (relative weight) --cpuset-cpus CPUs in which to allow execution (0-3, 0,1) --cpuset-mems MEMs in which to allow execution (0-3, 0,1) --disable-content-trust TRUE, Skip image verification --iidfile Write the image ID to the file --isolation Container isolation technology --memory , -m Memory limit --memory-swap Swap limit equal to memory plus swap: -1 to enable unlimited swap --no-cache Do not use cache when building the image --platform Set platform if server is multi-platform capable --pull Always attempt to pull a newer version of the image --security-opt Security options --shm-size Size of /dev/shm --squash Squash newly built layers into a single new layer --target Set the target build stage to build. --ulimit Ulimit options ➢ Some Options --file, -f : docker file name --label : set meta data for image --quite -q : suppress output --rm : Remove intermediate containers --tag, -t : set name or tag --add-host : Add custom host to IP mapping --network : set the networking mode for run commands ➢ Upon completion , it returns the image id
  • 6. Build a Docker Image with Dockerfile ➢ Verify the image is crated ▪ docker images ➢ Run an image ▪ docker run name:tag <options> --workdir , -w Working directory inside the container --hostname , -h Container host name --interactive , -i Keep STDIN open even if not attached --ip IPv4 address (e.g., 172.30.100.104) --label , -l Set meta data on a container --link Add link to another container --mount Attach a filesystem mount to the container --name Assign a name to the container --network Connect a container to a network --rm Automatically remove the container when it exits --mac-address Container MAC address (e.g., 92:d0:c6:0a:29:33) --memory , -m Memory limit --volume , -v Bind mount a volume
  • 7. Create a New Container Now, create a Docker container from the Docker image we created in the previous step. docker run --name it601p_m1