Docker Network:
In above diagram if one bridge container wants to communicate other they should communicate vai host interface.
Docker Network:
Docker volume: Theory
https://muhammadbasirbaig.medium.com/types-of-volumes-in-docker-9ddc84d6f5d9#:~:text=%20Types%20Of%20Volumes%20In%20Docker%20%201,if%20the%20data%20is%20only%20going...%20More%20
[root@ip-172-31-39-133 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest 70325c69f1fe 3 days ago 447MB
----
docker image inspect mysql
"Image": "sha256:70085967b5e8a570f801bad787ac3551abe82bd06aeeae4acc402c5f8f706948",
"Volumes": {
"/var/lib/mysql": {}
=---------------
[root@ip-172-31-39-133 ~]# docker container run -d --name mysql_demo -e MYSQL_ALLOW_EMPTY_PASSWORD=true mysql
fc9adc908367882debb884010f4093c56071df898924b21c1b187a36f253f731
[root@ip-172-31-39-133 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fc9adc908367 mysql "docker-entrypoint.s…" 6 seconds ago Up 5 seconds 3306/tcp, 33060/tcp mysql_demo
2ba149181b54 nginx "/docker-entrypoint.…" 14 hours ago Up 14 hours 80/tcp elegant_cray
[root@ip-172-31-39-133 ~]#
[root@ip-172-31-39-133 ~]# docker volume ls
DRIVER VOLUME NAME
local 83a13c22bec37287e671d8654b8fb8b19c48cbcc338a7f7ea54772ce1b71dd33
[root@ip-172-31-39-133 ~]#
[root@ip-172-31-39-133 _data]# pwd
/var/lib/docker/volumes/83a13c22bec37287e671d8654b8fb8b19c48cbcc338a7f7ea54772ce1b71dd33/_data
[root@ip-172-31-39-133 dockerdemo]# docker container exec -it fc9adc908367 bash
bash-4.4# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.30 MySQL Community Server - GPL
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.01 sec)
mysql> create database kishor
-> ;
Query OK, 1 row affected (0.01 sec)
mysql> create database satish
-> ;
Query OK, 1 row affected (0.01 sec)
mysql> create database satish
-> ;
ERROR 1007 (HY000): Can't create database 'satish'; database exists
mysql> create database ganesh;
Query OK, 1 row affected (0.01 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| ganesh |
| information_schema |
| kishor |
| mysql |
| performance_schema |
| satish |
| sys |
+--------------------+
7 rows in set (0.00 sec)
-------------
created new container:
[root@ip-172-31-39-133 dockerdemo]# docker container run -d --name mysql_demo -e MYSQL_ALLOW_EMPTY_PASSWORD=true mysql
54e7eace755057e125576b84098cbcd1eb2b44e878d932b8e8221dc23cbab6d2
[root@ip-172-31-39-133 dockerdemo]# docker exec -it 54e bash
bash-4.4# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.30 MySQL Community Server - GPL
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql>
================
[root@ip-172-31-39-133 dockerdemo]# docker run -itd -v 83a13c22bec37287e671d8654b8fb8b19c48cbcc338a7f7ea54772ce1b71dd33:/var/lib/mysql mysql
85901506b9ae2bab09c8a104b49d63db0a083e3dac5674c464d88d526e00ad69
[root@ip-172-31-39-133 dockerdemo]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
85901506b9ae mysql "docker-entrypoint.s…" 5 seconds ago Up 4 seconds 3306/tcp, 33060/tcp elated_jemison
54e7eace7550 mysql "docker-entrypoint.s…" 10 minutes ago Up 10 minutes 3306/tcp, 33060/tcp mysql_demo
[root@ip-172-31-39-133 dockerdemo]# docker exec -it 85901506b9ae bash
bash-4.4# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.30 MySQL Community Server - GPL
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| ganesh |
| information_schema |
| kishor |
| mysql |
| performance_schema |
| satish |
| sys |
+--------------------+
7 rows in set (0.15 sec)
mysql>
=============
[root@ip-172-31-39-133 ~]# docker volume create myvol
myvol
[root@ip-172-31-39-133 ~]# cd /var/lib/docker/volumes/
[root@ip-172-31-39-133 volumes]# ls -l
total 24
drwx-----x 3 root root 19 Aug 30 18:30 83a13c22bec37287e671d8654b8fb8b19c48cbcc338a7f7ea54772ce1b71dd33
drwx-----x 3 root root 19 Aug 30 18:36 8db408011f86a213df2975039da6177698f5cfcd9a8451d9b3bf54003fae502b
brw------- 1 root root 202, 1 Aug 30 18:58 backingFsBlockDev
-rw------- 1 root root 32768 Aug 30 18:59 metadata.db
drwx-----x 3 root root 19 Aug 30 18:59 myvol
drwx-----x 3 root root 19 Aug 30 18:50 test
[root@ip-172-31-39-133 volumes]# docker volume create myvol1
myvol1
[root@ip-172-31-39-133 volumes]# docker volume create myvol2
myvol2
[root@ip-172-31-39-133 volumes]# docker volume ls
DRIVER VOLUME NAME
local 8db408011f86a213df2975039da6177698f5cfcd9a8451d9b3bf54003fae502b
local 83a13c22bec37287e671d8654b8fb8b19c48cbcc338a7f7ea54772ce1b71dd33
local myvol
local myvol1
local myvol2
local test
-----------
Remove Volume:
[root@ip-172-31-39-133 volumes]# docker volume rm myvol2
myvol2
Prune Volume: Remove un used volume:
[root@ip-172-31-39-133 volumes]# docker volume prune
WARNING! This will remove all local volumes not used by at least one container.
Are you sure you want to continue? [y/N] y
Deleted Volumes:
myvol
myvol1
Total reclaimed space: 0B
[root@ip-172-31-39-133 volumes]#
==================
https://dockerlabs.collabnix.com/beginners/volume/create-a-volume-mount-from-dockerfile.html
==============
Bind Mount:
[root@ip-172-31-39-133 volumes]# cd /dockerdemo/
[root@ip-172-31-39-133 dockerdemo]# ls -l
total 114296
-rw-r--r-- 1 root root 34 Aug 30 04:36 Dockerfile
-rw-r--r-- 1 root root 117034496 Aug 30 03:53 mycon.tar
[root@ip-172-31-39-133 dockerdemo]# pwd
/dockerdemo
[root@ip-172-31-39-133 dockerdemo]# docker run -it -v /dockerdemo:/tmp/test ubuntu bash
root@5d3b1c485eb1:/# ls -l /tmp/test/
total 114296
-rw-r--r-- 1 root root 34 Aug 30 04:36 Dockerfile
-rw-r--r-- 1 root root 117034496 Aug 30 03:53 mycon.tar
root@5d3b1c485eb1:/#
---------------
Docker Network:
https://docs.docker.com/engine/reference/commandline/network/
https://monkelite.com/introduction-to-docker-networking/
FROM <Base Image>
RUN <To install software/packages>
ENV <Pass env variable>
ARG <Its will used image creation time>
FROM alpine
ARG TARGETPLATFORM
RUN echo "I'm building for $TARGETPLATFORM"
FROM ubuntu
ARG CONT_IMG_VER
ENV CONT_IMG_VER=$CONT_IMG_VER
RUN echo $CONT_IMG_VER
USER <Will switch user>
WORKDIR <Ir set working directory>
COPY <copy files from host to container>
ADD <copy remote files and extract it>
VOLUME /myvol <mount volume>
ENTRYPOINT
CMD
Dockerfile reference | Docker Documentation
Docker has a default entrypoint which is /bin/sh -c
but does not have a default command.
The ENTRYPOINT
specifies a command that will always be executed when the container starts.
The CMD
specifies arguments that will be fed to the ENTRYPOINT
.
If you want to make an image dedicated to a specific command you will use ENTRYPOINT ["/path/dedicated_command"]
Otherwise, if you want to make an image for general purpose, you can leave ENTRYPOINT
unspecified and use CMD ["/path/dedicated_command"]
as you will be able to override the setting by supplying arguments to docker run
.
For example, if your Dockerfile is:
FROM debian:wheezy
ENTRYPOINT ["/bin/ping"]
CMD ["localhost"]
The ENTRYPOINT specifies a command that will always be executed when the container starts.
The CMD specifies arguments that will be fed to the ENTRYPOINT
FROM debian:wheezy
CMD ["/bin/ping", "localhost"]
The ENTRYPOINT
is the program that will be run, and the value passed to the container will be appended to it.
The ENTRYPOINT
can be overridden by specifying an --entrypoint
flag, followed by the new entry point you want to use.
====================
CMD
defines default commands and/or parameters for a container. CMD is an instruction that is best to use if you need a default command which users can easily override. If a Dockerfile has multiple CMDs, it only applies the instructions from the last one.
ENTRYPOINT
is preferred when you want to define a container with a specific executable.
You cannot override an ENTRYPOINT
when starting a container unless you add the --entrypoint
flag.
CMD Docker file
FROM centos:8.1.1911
CMD ["echo", "Hello Docker"]
Run result
$ sudo docker run <image-id>
Hello Docker
$ sudo docker run <image-id> hostname # hostname is exec to override CMD
244be5006f32
ENTRYPOINT
Docker file
FROM centos:8.1.1911
ENTRYPOINT ["echo", "Hello Docker"]
Run result
$ sudo docker run <image-id>
Hello Docker
$ sudo docker run <image-id> hostname # hostname as parameter to exec
Hello Docker hostname
- There are many situations in which combining CMD and ENTRYPOINT would be the best solution for your Docker container. In such cases, the executable is defined with ENTRYPOINT, while CMD specifies the default parameter.
Docker file
FROM centos:8.1.1911
ENTRYPOINT ["echo", "Hello"]
CMD ["Docker"]
Run result
$ sudo docker run <image-id>
Hello Docker
$ sudo docker run <image-id> Ben
Hello Ben
430 vi Dockerfile
431 docker logs bc59d1bb68dc
432 docker ps
433 docker kill bc59d1bb68dc
434 docker ps
435 docker
436 mkdir /dockerdemo
437 cd /dockerdemo/
438 vi Dockerfile
439 docker build -t myubuntuimage:1.0 .
440 docker images
441 docker container run -it myubuntuimage:1.0
442 vi Dockerfile
443 docker build -t myubuntuimage:2.0 .
444 docker container run -it myubuntuimage:2.0
445 docker ps
446 docker container commit --author "Kishor Aswar" -m "THis is my Customized image" c8d9f6e1db26 my_new_image
447 docker images
448 docker cp /tmp/index.html c8d9f6e1db26:/tmp
449 docker exec c8d9f6e1db26 ls /tmp
450 docker exec c8d9f6e1db26 ls -l /tmp
451 date
452 docker diff c8d9f6e1db26
453 docker cp /var/log/messages c8d9f6e1db26:/tmp
454 docker diff c8d9f6e1db26
455 docker events c8d9f6e1db26
456 docker events --help
457 docker events -since index c8d9f6e1db26
458 docker events --since index c8d9f6e1db26
459 docker events --since '2022' c8d9f6e1db26
460 docker events --since '2022'
461 docker ps
462 docker container export c8d9f6e1db26 >mycon.tar
463 ls -l
464 docker image import mycon.tar my_inported_image
465 docker images
466 docker run -d my_inported_image
467 docker container run -d my_inported_image
468 docker container run my_inported_image
469 dcoker container run nginx
470 docker container run nginx
471 docker container run -d my_inported_image /bin/bash
472 docker images
473 docker ps
474 docker ps -a
475 docker ps
476 docker history c8d9f6e1db26
477 docker container history c8d9f6e1db26
478 docker container history
479 docker history
480 docker history --help
481 docker images
482 docker history my_inported_image
483 docker history nginx
484 docker info
485 docker ps
486 docker inspect c8d9f6e1db26
487 docker ps
488 docker kill c8d9f6e1db26
489 docker stop 6463aa45b2d0
490 docker images
491 docker login
492 docker pull httpd
493 docker images
494 docker pull httpd:2.4.54
495 docker images
496 vi Dockerfile
497 docker build -t kishoraswar/myrepo:v1 .
498 docker images
499 docker push kishoraswar/myrepo:v1
500 docker login
501 docker ps
502 docker run -it ubuntu
503 docke rps
504 docker ps
505 docker container restart ed625cb0b5ba
506 docker ps
507 docker stop ed625cb0b5ba
508 docker container ls -a
509 docker ps -a
510 docker rm $(docker ps -a)
511 docker rm $(docker ps -a -f status=exited -q)
512 docker ps -a
513 docker ps
514 docker rm $(docker ps -a -f status=created -q)
515 docker images
516 docker rmi my_inported_image
517 docker images
518 docker rmi $(docker images -a -q)
519 docker images
520 docker rmi $(docker images -a -q)
521 docker rmi $(docker images -a -f -q)
522 docker prune images
523 docker images
524 docker rmi kishoraswar/myrepo
525 docker rmi kishoraswar/myrepo:v1
526 docker images
527 docker rmi $(docker images -a -q)
528 docker rmi myubuntuimage:2.0
529 docker images
530 docker rmi myos*
531 docker rmi myos:2.0
532 docker images
533 docker search nginx
534 docker container run -it ubuntu
535 docker ps
536 docker stats
537 docker images
538 docker tag
539 docker tag myos:3.0 new_image:1.0
540 docker images
541 docker ps
542 top
543 docker ps
544 docker top 2906c6761ae7
545 docker ps
546 docker pause 2906c6761ae7
547 docker ps
548 docker unpause 2906c6761ae7
549 docker ps
550 docker images
551 docker run -d nginx
552 docker ps
553 docker nginx
554 docker ps
555 rm Dockerfile
556 vi Dockerfile
557 ls -l
558 pwd
559 cd /opt
560 docker build -t myimage:1.0 .
561 docker build -t myimage:1.0 -f /dockerdemo/Dockerfile
562 docker build -t myimage:1.0 /dockerdemo/Dockerfile -
563 docker build -t myimage:1.0 /dockerdemo/Dockerfile .
564 docker build --help
565 docker build -t myimage:1.0 -f /dockerdemo/Dockerfile
566 cd /dockerdemo/
567 ls -l
568 docker build -t testimage .
569 docker images
570 mv Dockerfile myfile
571 docker build -t testimage1 -f myfile
572 docker build -t testimage1 -f myfile -
573 docker images
574 docker container run -d testimage
575 docker ps
576 docker ps -a
577 ls -l
578 mv myfile Dockerfile
579 vi Dockerfile
580 docker build -t test1 .
581 vi Dockerfile
582 history
Management Commands:
builder Manage builds
config Manage Docker configs
container Manage containers
context Manage contexts
image Manage images
manifest Manage Docker image manifests and manifest lists
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
secret Manage Docker secrets
service Manage services
stack Manage Docker stacks
swarm Manage Swarm
system Manage Docker
trust Manage trust on Docker images
volume Manage volumes
Commands:
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
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes to files or directories on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
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
login Log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save one or more images to a tar archive (streamed to STDOUT by default)
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
version Show the Docker version information
wait Block until one or more containers stop, then print their exit codes
1)Docker Introduction and Architecture - Done
2)Docker Installation and Docker Info - Done
3)Create First Container, List Container, Remove Container
Create: docker container run --name=kishor -d nginx
# docker container ls
#docker ps
#docker ps -a
#docker container ls -a
[root@ip-172-31-39-133 ~]# docker container stop d13851e2b5fb
d13851e2b5fb
[root@ip-172-31-39-133 ~]# docker container rm d13851e2b5fb
d13851e2b5fb
4)Create Container in background, stop, start, detach container.
[root@ip-172-31-39-133 ~]# docker container run -d httpd
d85bfc54941ec18d2ec4380e9098989ff23872843cc39862bd09389e984ff60c
[root@ip-172-31-39-133 ~]# docke rps
-bash: docke: command not found
[root@ip-172-31-39-133 ~]# docker ps
'CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d85bfc54941e httpd "httpd-foreground" 4 seconds ago Up 4 seconds 80/tcp intelligent_satoshi
5)Docker Container Inspect
docker inspect d85bfc54941e|less
6)Whats going on inside the container
#docker logs d85bfc54941e
7)Docker port mapping, rename container, restart the container, exec container
[root@ip-172-31-39-133 ~]# docker run -d -p 3306:80 nginx
ba313210c37b5a4193d92317a2734087555072e1c614eec80185708fd6fce98b
[root@ip-172-31-39-133 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ba313210c37b nginx "/docker-entrypoint.…" 2 seconds ago Up 1 second 0.0.0.0:3306->80/tcp, :::3306->80/tcp musing_poitras
8)Attach to a running container, kill, wait, pause, unpause, prune, port
[root@ip-172-31-39-133 ~]# docker rm $(docker ps -a -f status=exited -q)
351171d12678
d6e05ed3325b
ab0bcc80a5f3
[root@ip-172-31-39-133 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@ip-172-31-39-133 ~]#
9)Create docker container, diff docker container and copy file into container.
10)Export/Import Docker Container.
#docker container ls
#docker container export 351171d12678 > my_ubuntu.tar
#ls -l
#docker image import my_ubuntu.tar my_ubunut
#docker images
#docker container run -it my_ubunut
#docker container run -it my_ubunut /bin/bash
11)How to create docker image from a running container.
[root@ip-172-31-39-133 ~]# docker container commit --author "Kishor Aswar" -m "THis is my Customized image" 351171d12678 my_con_image
sha256:e8f2927cc89c7c2de6828369e1f0c3107a6a017814abf075a444f873818c540c
[root@ip-172-31-39-133 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
my_con_image latest e8f2927cc89c 7 seconds ago 114MB
[root@ip-172-31-39-133 ~]# docker run -it my_con_image /bin/bash
root@7b5ba6313bee:/#
12)How to push image on docker hub, image tag, image pull, docker login.
https://hub.docker.com/
[root@ip-172-31-39-133 ~]# docker pull nginx:1.23
1.23: Pulling from library/nginx
7a6db449b51b: Pull complete
ca1981974b58: Pull complete
d4019c921e20: Pull complete
7cb804d746d4: Pull complete
e7a561826262: Pull complete
7247f6e5c182: Pull complete
Digest: sha256:b95a99feebf7797479e0c5eb5ec0bdfa5d9f504bc94da550c2f58e839ea6914f
Status: Downloaded newer image for nginx:1.23
docker.io/library/nginx:1.23
[root@ip-172-31-39-133 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx 1.23 2b7d6430f78d 5 days ago 142MB
[root@ip-172-31-39-133 ~]#
[root@ip-172-31-39-133 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx 1.23 2b7d6430f78d 5 days ago 142MB
ubuntu latest df5de72bdb3b 3 weeks ago 77.8MB
[root@ip-172-31-39-133 ~]# docker image tag ubuntu kishoraswar/ubuntu_new
[root@ip-172-31-39-133 ~]# docker image push
"docker image push" requires exactly 1 argument.
See 'docker image push --help'.
Usage: docker image push [OPTIONS] NAME[:TAG]
Push an image or a repository to a registry
[root@ip-172-31-39-133 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx 1.23 2b7d6430f78d 5 days ago 142MB
kishoraswar/ubuntu_new latest df5de72bdb3b 3 weeks ago 77.8MB
ubuntu latest df5de72bdb3b 3 weeks ago 77.8MB
[root@ip-172-31-39-133 ~]# docker image push kishoraswar/ubuntu_new
Using default tag: latest
The push refers to repository [docker.io/kishoraswar/ubuntu_new]
629d9dbab5ed: Mounted from library/ubuntu
latest: digest: sha256:42ba2dfce475de1113d55602d40af18415897167d47c2045ec7b6d9746ff148f size: 529
[root@ip-172-31-39-133 ~]#
[root@ip-172-31-39-133 ~]# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: kishoraswar
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
13)How to inspect, list and history of docker image.
[root@ip-172-31-39-133 ~]# docker image history df5de72bdb3b
IMAGE CREATED CREATED BY SIZE COMMENT
df5de72bdb3b 3 weeks ago /bin/sh -c #(nop) CMD ["bash"] 0B
<missing> 3 weeks ago /bin/sh -c #(nop) ADD file:396eeb65c8d737180… 77.8MB
[root@ip-172-31-39-133 ~]#
15)Layered architecture and Dockerfile
[root@ip-172-31-39-133 ~]# cat Dockerfile
FROM ubuntu
MAINTAINER Kishor Aswar
USER root
RUN apt-get update -y
RUN apt-get install tree -y
RUN touch /tmp/file1
RUN touch /tmp/file2
[root@ip-172-31-39-133 ~]# vi Dockerfile
[root@ip-172-31-39-133 ~]# docker build -t myos:3.0 .
Sending build context to Docker daemon 116.4MB
Step 1/7 : FROM ubuntu
---> df5de72bdb3b
Step 2/7 : MAINTAINER Kishor Aswar
---> Using cache
---> c9e9b6a1ef5a
Step 3/7 : USER root
---> Using cache
---> db9cf470d44a
Step 4/7 : RUN apt-get update -y
---> Using cache
---> 400b74a03009
Step 5/7 : RUN apt-get install tree -y
---> Using cache
---> d5f601900dde
Step 6/7 : RUN touch /tmp/file1
---> Running in 0e7ead191ce1
Removing intermediate container 0e7ead191ce1
---> ba71d11f5172
Step 7/7 : RUN touch /tmp/file2
---> Running in 3da57cf7a554
Removing intermediate container 3da57cf7a554
---> 33bb176bdbdf
Successfully built 33bb176bdbdf
Successfully tagged myos:3.0
[root@ip-172-31-39-133 ~]# docker images -a
REPOSITORY TAG IMAGE ID CREATED SIZE
myos 3.0 33bb176bdbdf 9 seconds ago 115MB
<none> <none> ba71d11f5172 10 seconds ago 115MB
myos 2.0 d5f601900dde 6 minutes ago 115MB
<none> <none> 400b74a03009 6 minutes ago 114MB
<none> <none> db9cf470d44a 7 minutes ago 77.8MB
myos 1.0 c9e9b6a1ef5a 14 minutes ago 77.8MB
nginx latest 2b7d6430f78d 6 days ago 142MB
httpd latest a981c8992512 6 days ago 145MB
ubuntu latest df5de72bdb3b 3 weeks ago 77.8MB
centos latest 5d0da3dc9764 11 months ago 231MB
[root@ip-172-31-39-133 ~]#
17)Dockerfile(ADD, COPY, USER)
18)Dockerfile(CMD)
19)Dockerfile(Expose and create a SSH container using dockerfile)
20)Dockerfile(ENTRYPOINT)
Docker difference between run, cmd, entrypoint commands (til.codes)
Use RUN instructions to build your image by adding layers on top of initial image.
Prefer ENTRYPOINT to CMD when building executable Docker image and you need a command always to be executed. Additionally use CMD if you need to provide extra default arguments that could be overwritten from command line when docker container runs.
Choose CMD if you need to provide a default command and/or arguments that can be overwritten from command line when docker container runs.
21)Docker Volume(Docker Storage), mysql data persist in docker container
22)Docker Volume Creation
23)Docker volume(Remove, Prune)
24)Docker Bind Mount
25)Docker networking(Bridge, Host, Null)
26)Docker Network(Connect, Disconnect)
27)Docker network(Remove, Prune)
28)Docker Registry/Repository(Insecure)
29)Docker Registry With Basic Authentication)
Docker Compose/swarm
Kubernetes
https://padmakshi.medium.com/setting-up-an-eks-cluster-and-deploying-a-game-application-a-step-by-step-guide-08790e0be117