Docker Part1
Class 79th DOCKER INTRO Part1 1st August
Monolithic :Means single application ,server database deployed in single server is called monolithic application
Microservice: We have split the server and service muliple instance for single application
APPLICATION: Collection of services
MONOLITHIC: multiple services are deployed on single server with single database.
MICRO SERVICES: multiple services are deployed on multiple servers with multiple database.
- Its an free & opensource tool.
- it is platform independent.
- used to create, run & deploy applications on containers.
- it is introduced on 2013 by solomenhykes & sebastian phal.
- We used GO language to develop the docker.
- here we write files on YAML.
- before docker user faced lot of problems, but after docker there is no issues with the application.
- Docker will use host resources (cpu, mem, n/w, os).
- Docker can run on any OS but it natively supports Linux distributions.
Step9:
root@91c51df69572:/# cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.2 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo
root@ip-10-0-2-61:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
movies v1 c6fcfdddf5a7 3 days ago 245MB
root@ip-10-0-2-61:~# docker rmi c6fcfdddf5a7
Error response from daemon: conflict: unable to delete c6fcfdddf5a7 (must be forced) - image is being used by stopped container deff3a8b49f6
root@ip-10-0-2-61:~# docker rmi -f c6fcfdddf5a7
Untagged: movies:v1
Deleted: sha256:c6fcfdddf5a73dad77f764c06db339423e85dd4f86b0a6e70a0f308ecea67200
Deleted: sha256:40ae56197fccc7a31d299cd3e9ddc0f66fdd574b5773dc1df7c886934696312c
Deleted: sha256:4d61e0aa2aa1b2c034371f2b68b212fb7996120cbc8c816c9a712e953fcc7a03
Deleted: sha256:10cacaa9c6716e0559888cc54af4a44beb606a48d0f87cfd81c14c638d8a2d7c
Deleted: sha256:65ae7a6f3544bd2d2b6d19b13bfc64752d776bc92c510f874188bfd404d205a3
root@ip-10-0-2-61:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
root@ip-10-0-2-61:~#
root@ip-10-0-2-61:~# docker pull ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
32f112e3802c: Already exists
Digest: sha256:a08e551cb33850e4740772b38217fc1796a66da2506d312abe51acda354ff061
Status: Downloaded newer image for ubuntu:latest
docker.io/library/ubuntu:latest
root@ip-10-0-2-61:~#
root@ip-10-0-2-61:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 65ae7a6f3544 3 weeks ago 78.1MB
root@ip-10-0-2-61:~#
root@ip-10-0-2-61:~# docker pull redhat/granite-3-2b-instruct
Using default tag: latest
latest: Pulling from redhat/granite-3-2b-instruct
40049f9dc504: Pull complete
968eabd7fc8a: Downloading [================> ] 769.4MB/2.28GB
1e37173e4f88: Download complete
context canceled
root@ip-10-0-2-61:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 65ae7a6f3544 3 weeks ago 78.1MB
root@ip-10-0-2-61:~# docker run --name container1 ubuntu
root@ip-10-0-2-61:~# docker run -it --name container1 ubuntu
root@92dc1437896a:/# ^C
root@92dc1437896a:/# apt update
root@92dc1437896a:/# apt install nginx
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
iproute2 libatm1t64 libbpf1 libcap2-bin libelf1t64 libmnl0 libpam-cap libxtables12 nginx-common
Suggested packages:
iproute2-doc python3:any fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed:
iproute2 libatm1t64 libbpf1 libcap2-bin libelf1t64 libmnl0 libpam-cap libxtables12 nginx nginx-common
0 upgraded, 10 newly installed, 0 to remove and 4 not upgraded.
Need to get 2025 kB of archives.
After this operation, 5799 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Abort.
root@92dc1437896a:/#
root@92dc1437896a:/#
root@92dc1437896a:/# apt install nginx
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
iproute2 libatm1t64 libbpf1 libcap2-bin libelf1t64 libmnl0 libpam-cap libxtables12 nginx-common
Suggested packages:
iproute2-doc python3:any fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed:
iproute2 libatm1t64 libbpf1 libcap2-bin libelf1t64 libmnl0 libpam-cap libxtables12 nginx nginx-common
0 upgraded, 10 newly installed, 0 to remove and 4 not upgraded.
Need to get 2025 kB of archives.
After this operation, 5799 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
root@92dc1437896a:/# ls
bin bin.usr-is-merged boot dev etc home lib lib64 media mnt opt proc root run sbin sbin.usr-is-merged srv sys tmp usr var
root@92dc1437896a:/#
exit
root@ip-10-0-2-61:~# docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
92dc1437896a ubuntu "/bin/bash" 7 minutes ago Exited (0) About a minute ago container1
deff3a8b49f6 c6fcfdddf5a7 "/usr/sbin/apachectl…" 3 days ago Exited (0) 3 days ago cont1
root@ip-10-0-2-61:~# docker container ls -pq
unknown shorthand flag: 'p' in -pq
See 'docker container ls --help'.
root@ip-10-0-2-61:~# docker container ls -p
unknown shorthand flag: 'p' in -p
See 'docker container ls --help'.
root@ip-10-0-2-61:~# docker run -it --name container1 ubuntu
docker: Error response from daemon: Conflict. The container name "/container1" is already in use by container "92dc1437896aa0ebba784e987052c682ada5c66229501195529b4422bce505fd". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
root@ip-10-0-2-61:~# docker run --name container1 ubuntu
docker: Error response from daemon: Conflict. The container name "/container1" is already in use by container "92dc1437896aa0ebba784e987052c682ada5c66229501195529b4422bce505fd". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
root@ip-10-0-2-61:~# docker run ubuntu
root@ip-10-0-2-61:~# docker run -it --name container1 ubuntu
docker: Error response from daemon: Conflict. The container name "/container1" is already in use by container "92dc1437896aa0ebba784e987052c682ada5c66229501195529b4422bce505fd". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
root@ip-10-0-2-61:~# docker run -it --name container1
"docker run" requires at least 1 argument.
See 'docker run --help'.
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Step 11: after inside container control p+q, container is up and running not exist
Control+d exit from the contrainer
Create and run a new container from an image
root@ip-10-0-2-61:~# docker run -it --name container2 ubuntu
root@91c51df69572:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@91c51df69572:/# cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.2 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo
root@91c51df69572:/# root@ip-10-0-2-61:~#
root@ip-10-0-2-61:~# docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
91c51df69572 ubuntu "/bin/bash" 2 minutes ago Up 2 minutes container2
c7863af60d25 ubuntu "/bin/bash" 3 minutes ago Exited (0) 2 minutes ago blissful_bose
92dc1437896a ubuntu "/bin/bash" 15 minutes ago Exited (0) 10 minutes ago container1
deff3a8b49f6 c6fcfdddf5a7 "/usr/sbin/apachectl…" 3 days ago Exited (0) 3 days ago cont1
root@ip-10-0-2-61:~#
Step 12 :Start the container manually using below command
root@ip-10-0-2-61:~# docker start container1
container1
root@ip-10-0-2-61:~# docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
91c51df69572 ubuntu "/bin/bash" 8 minutes ago Up 8 minutes container2
c7863af60d25 ubuntu "/bin/bash" 9 minutes ago Exited (0) 9 minutes ago blissful_bose
92dc1437896a ubuntu "/bin/bash" 22 minutes ago Up 30 seconds container1
No comments:
Post a Comment