Docker Theory 1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Docker: -

What is Docker used for?


Docker is a software platform that allows you to build, test, and deploy applications quickly.
Docker packages software into standardized units called containers that have everything the
software needs to run including libraries, system tools, code, and runtime.

container: - It is a lightweight, standalone, and executable software package that includes


everything needed to run a piece of software, including the code, runtime, system tools, and
libraries.

Containers are designed to isolate applications and their dependencies, ensuring that they can
run consistently across different environments. Whether the application is running from your
computer or in the cloud, the application behaviour remains the same.

**Install Docker on your server: -


1.connect ec2 instant via ssh
copy ssh url and paste it in cloudshell terminal
2.sudo apt-get update
3.sudo apt-get install.io
4.systemctl status docker -
5. docker ps - permission denied
6.cat/etc/group, sudo usermod -aG docker $USER
7.cat/etc/group
8.Sudo reboot
9.docker ps - permission allowed
1.docker ps -a
1.mysql
.docker run mysql:5.7
.docker run -e MYSQL_ROOT_PASSWORD=test123 mysql:5.7
1. My sql is ready for connections.
2. docker ps, docker stop container id.
3. I want to run this container in detached mode.
4. docker run -d -e MYSQL_ROOT_PASSWORD=test123 mysql:5.7

see what inside the container:


5. docker exec -it container id bash
6. ls
7. mysql -u root -p
8. enter pass
9. show databases;
10. exit ,exit- your on your local
How to make docker file, image and container
1. mkdir docker-projects
2. ls
3. cd docker-projects
4. ls
5. mkdir java-app
6. cd java-app
7. vim hello.java-enter – add simple java program
8. cat hello.java
9. clear
10. ls
Lets make a file
1. vim Dockerfile
2. esc:wq
3. ls
4. docker build -t java-app:latest . enter .........-t--->tag
5. docker images
6. docker run java-app:latest enter

Base Image: -
A base image is the image that is used to create all of your
container images. Your base image can be an official Docker image, such as
Centos, or you can modify an official Docker image to suit your needs, or you
can create your own base image from scratch.

Flask-app:
1.ls
2.cd . .
1. mkdir flask-app
2. ls
3. cd mkdir flask-app/
4. ls
5. vim app.py
6. rm vim app.py
7. git clone repo
8. pip- python package installer
9. docker build . -t flask-app:latest
10. docker images
11. docker run flask-app:latest

Node js App:
1. docker file
2. run
3. push to dockerhub
4. volume
5. networking
6. jenkins
7. SecOps
The command “docker container prune” is used to remove all stopped containers in docker.
https://t.me/+TKbM2D976Y05YjBl

You might also like