10. Docker – Implementation => How to RUN and REMOVE a Container.
Docker – Implementation => How to RUN and REMOVE a Container.
RUN a Container.
01. Build an image =>
docker build -f
Dockerfile_name -t give_a_name_to_image
If docker file name is Dockerfile,
docker build . -t give_a_name_to_image
Otherwise
docker build -f abc -t docker_springboot_h2 .
02. Show images =>
docker images
Show
images list => docker image ls
03. VIEW ALL CONAINER
PROCESS => docker ps -a
04. RUN A CONTAINER =>
docker run -p 8082:8080 --name
containerName -d image_name_OR_id
-p
8082:8080 :- 8082:FOR LOCAL ACCESS THE CONTAINER. 8080 IS FOR INSIDE THE
CONTAINER.
WE
HIT TO localhost:8082 AND THEN GO TO THAT CONTAINER AND 8082 is MAP WITH 8080.
05. CURRENTLY RUNNUNG
CONTAINERS => docker container ls
06. docker container log => docker logs springboot_h2_container
07. Kill a container => docker
kill container_name_OR_id
08. docker start container_name_or_id
REMOVE a Container.
01. FIRST CONTANERS SHOULD BE REMOVED, THEN IMAGE SHOULD BE
REMOVED
1. KILL A CONTAINER => Docker kill container_name_OR_id
OR
1. STPO A CONTAINER => docker stop controller_name_OR_id
2. REMOVE A CONTAINR => container rm container_name_OR_id
3. REMOVE AN IMAGE => docker rmi image__name_OR_id
4. RUN docker container ls AND docker images TO CHECK WHETHER SUCCESSFULLY REMOVE OR NOT
Comments
Post a Comment