Skip to content

Commit

Permalink
Merge pull request #7 from artbindu/docker_learn
Browse files Browse the repository at this point in the history
Docker learn docs with docker config
  • Loading branch information
artbindu authored Oct 15, 2024
2 parents d03b6b6 + 1fa52eb commit 1d565c8
Show file tree
Hide file tree
Showing 12 changed files with 172 additions and 48 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
**/node_modules/
**/dist
.git
npm-debug.log
package-lock.json
*.md
.gitignore
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"package.json": "package-lock.json",
"package.json": "package-lock.json, dockerfile, *.yaml, .dockerignore",
"README.md": "*.md, *.ico, LICENSE, .gitignore"
}
}
6 changes: 6 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
img:
build: .
container_name: essential-command
ports:
- 12345:12345
8 changes: 4 additions & 4 deletions data/cmdIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

[Command](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands) | Description
------- | --------
**`1. Create/Delete User & Activted Administrator Account`** |
**`1. Create/Delete User & Activated Administrator Account`** |
`net user` | see all user list
`rd /s /q <dir_name>` or<br>`rd /s /q <path>\<dir_name>` | delete directory
`Xcopy <dir_name> <path> /E/H/C/I` or<br>`Xcopy <path>\<dir_name> <path> /E/H/C/I`| Copy Directory<br>`/E`–Copy subdirectories, including any empty ones.<br>`/H`-Copy files with hidden and system file attributes<br>`/C`-Continue copying even if an error occurs.<br>`/I`-If in doubt, always assume the destination is a folder
|
**`2. System Info`** |
`ipconfig` | ipdetails [IPv4 Address / Default Gateway]
`win + r` + `dxdiag` | get all of your systeminfo
`win + r` + `dxdiag` | get all of your system info
`whoami` | see current user id
`perfmon /report` | system report
`powercfg /batteryreport` | battery info (.html file)
Expand All @@ -21,7 +21,7 @@
**`3. ping related config`**|
`ping <ip>` <br> `ping <host>.<domain>` | check connect with that `host`
`ping <ip> -t` <br> `ping <host.domain> -t` | continuously checking connection with that host
`tracert <ip>` <br> `tracert <host>.<domain>` | traceroute ip<br> traceroute host
`tracert <ip>` <br> `tracert <host>.<domain>` | Trace route ip<br> Trace route host
`ipconfig/all` | Ipconfig shows IP address, Subnet Mask, and Default gateway for all adapters. Ipconfig /all shows the description of each network connection along with additional information such as your physical (MAC) address, DHCP connections, Lease times, as well as in-depth IPv6 information.
|
**[wmic](https://docs.microsoft.com/en-us/windows/win32/wmisdk/wmic) : `Windows Management Interface Command details`**| `returns information about the system`
Expand All @@ -38,7 +38,7 @@
`wmic os list brief` | List Brief Operating System Information
`wmic partition get name,size,type` | Disk Partition Name, Size, and Type
`wmic path SoftwareLicensingService get OA3xOriginalProductKey` | System product key
`wmic process get workingsetsize,commandline` | Print All Running Application, Programmes, and Their RAM/Memory Usage
`wmic process get workingsetsize, commandline` | Print All Running Application, Programmes, and Their RAM/Memory Usage
`wmic process list brief` | List Process
`wmic process list brief > process.txt` | Write WMIC Output Into A File
`wmic process where name="chrome.exe" call terminate` | Kill Given Process
Expand Down
2 changes: 1 addition & 1 deletion data/cmdLearning.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ Command | Description
`Shutdown /l` Or `Windows + r + logoff`| Logoff computer
`Shutdown /a`|Abort the shutdown process before the timeout;
`Shutdown -s -t <seconds>` | Shutdown using timer
`shutdown -r -t <seconds> ` | Shutdown and then researt using timer
`shutdown -r -t <seconds> ` | Shutdown and then ReStart using timer

93 changes: 93 additions & 0 deletions data/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!-- # Docker Learning -->

## Docker Learning

### What is Docker?
A platform that helps developers build, share & run applications with container.

### What is Docker Images and Containers?
Images:- Are templates of Project
Container:- Running Instance of Image

#### Docker Images
- It's kind of ready-to-use software read-only template
- Images is made with source codes, libraries, external dependencies and tools.
- Images can not be updated.
- If you want to make change in image you have to create new image
- Images can not run directly.</br>

- **Example of Images**:</br>
- Node.js Setup
- React setup
- Code of application
- Dependencies
- Other supporting tools
- docker file
So, Docker Image is a template of our project.</br>

#### Docker Containers
- Container is a process that runs applicatin with images
- Container is an isolated process
- Means Container run independently on computer

#### Docker Images Type
Docker Image | description
------- | --------
Parent Image | Not Depend on other Image like: [Node.js](https://hub.docker.com/_/node), [PHP](https://hub.docker.com/_/php), [Python](https://hub.docker.com/_/python)
Base Image | Depend on Base Image. Example: React App required base image of 'Node.js'

### Basic Command of Docker
Command | description
------- | --------
help | `docker -help`
version | `docker --version`
[Pull Docker Images](https://hub.docker.com) | `docker pull <docker_image_version>` <br> <br> Node.js ≡ `docker pull node:lts-slim` <br> Python ≡ `docker pull python`
Run Docker Image |`doker run -it <docker_image_name>` <br>or<br> `docker run -it <docker_image_name> /bin/bash` <br><br> Node.js ≡ `docker run -it node:lts-slim /bin/bash` <br> Python ≡ `docker run -it python /bin/bash`
Create Docker file| `touch dockerfile` <br> need to install `touch-cli` globally
Create Docker Images | `docker build -t <docker_image_name_in_lowercase> .` <br> Run this with in your application directory where you crate the docker file
Show all Docker Containers | `docker ps -a`
Show all Docker Images | `docker images`
Run Docker Images | `docker run --name <docker_container_name> -p <host_port>:<default_app_port> <docker_image_name>`
Start Docker Container | `docker container start <docker_image_name>`
Stop Docker Container | `docker container stop <docker_image_name>`
Delete Docker Containers | `docker container rm <docker_container_name>`
Delete Docker Images | `docker image rm <docker_image_name>`
Delete Docker Containers (Forcefully)| `docker container rm <docker_container_name> -f`
Delete Docker Images (Forcefully) | `docker image rm <docker_image_name> -f`
Delete all Docker Images/Container | `docker system prune -a`
Create Docker image (with version) | `docker build -t <docker_image_name>:<app_version> .`
Run Docker Images (with version) | `docker run --name <docker_container_name> -p <host_port>:<default_app_port> <docker_image_name>:<docker_image_version>`
-|-
View Other Docker Images Command | `docker image COMMAND`
View Other Docker Container Command | `docker container COMMAND`

### Docker File Sample
```
# Pull Docker Image/s
FROM <Docker Image Name>
# Mention Project Destination if required
WORKDIR <Destination directory name>
# Copy image from source to destination
COPY <Source> <Destination>
# Install Packages
RUN <Packages Install Script>
# Mention App Port
EXPOSE <Port No>
# Run project - Mention app run Script
CMD [<comma separator command with double quotes>]
```

#### What is Docker Compose File?
Run Docker Compose File : `docker compose up`

### Docker Compose Sample File
```
# Docker Services
Services:
# Docker Image Config
img:
build: <docker_image_destination>
container_name: <docker_image_name>
ports:
- <host_port>:<default_app_port>
```
4 changes: 2 additions & 2 deletions data/gitLearning.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ Command | description
`git push origin master` | push at your original branch
`git commit -am "<enter_message>"`| add your existing files changes & commit in a single time
`git add <filePath_with_Name_01>` | add your changes for particular file(s)
`git push --set-upstream origin <branch_name>` | Create a new branch in remote repository and commited changes push into that branch.
`git push --set-upstream origin <branch_name>` | Create a new branch in remote repository and committed changes push into that branch.
**`6. Rename & Delete your branch`** |
`git branch -m <new_branch_name>` | rename a branch<br>Stay outside of this branch
`git branch -d <delete_branch_name>` <br>or<br> `git branch -D <delete_branch_name>` | delete local branch<br>Stay outside of this branch
`git remote rename origin <new_branch_name>` | Rename the origin remote to new_branch_name
`git remote prune origin` <br>or<br> `git remote prune origin`| Remove all deleted branches from remote
`git remote prune origin` <br>or<br> `git fetch --prune`| Remove all deleted branches from remote
**`7. Revert, Reset or Clean your changes or directory`** |
`git revert HEAD` | revert the last changes
`git revert HEAD --no-edit` | revert the latest commit
Expand Down
4 changes: 2 additions & 2 deletions data/mysql.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!-- # Database Learning: MySQL --
<!-- # Database Learning: MySQL -->

## MySQL Learning

Expand Down Expand Up @@ -106,7 +106,7 @@ TRUNCATE TABLE table_name;

```

9. TCL (Rransaction Control language) Query:
9. TCL (Transaction Control language) Query:
```sql

```
Expand Down
2 changes: 1 addition & 1 deletion data/plpgsql.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!-- # Database Learning: PostgreSQL --
<!-- # Database Learning: PostgreSQL -->

## PlpgSQL Learning

Expand Down
7 changes: 7 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:16.15.1
RUN npm install -g nodemon
WORKDIR /essential-command
COPY . .
RUN npm install
EXPOSE 5112
CMD ["npm", "run", "start"]
79 changes: 44 additions & 35 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,39 @@
<div class="fixed-div">
<ul id="myList">
<li><a href="#windows">
<img align="center" width="20px" style="padding:5px;"
src="https://cdn.worldvectorlogo.com/logos/microsoft-windows-22.svg" />
Windows</a>
<img align="center" width="20px" style="padding:5px;"
src="https://cdn.worldvectorlogo.com/logos/microsoft-windows-22.svg" />
Windows</a>
</li>
<li><a href="#windows-it">
<img align="center" width="20px" style="padding:5px;"
src="https://cdn.worldvectorlogo.com/logos/terminal-1.svg" />
Windows-IT</a>
<img align="center" width="20px" style="padding:5px;"
src="https://cdn.worldvectorlogo.com/logos/terminal-1.svg" />
Windows-IT</a>
</li>
<li><a href="#linux">
<img align="center" width="20px" style="padding:5px;"
src="https://cdn.simpleicons.org/linux" />
Linux</a>
<img align="center" width="20px" style="padding:5px;"
src="https://cdn.simpleicons.org/linux" />
Linux</a>
</li>
<li><a href="#macos">
<img align="center" width="20px" style="padding:5px;"
src="https://cdn.simpleicons.org/apple/white" />
MacOs</a>
<img align="center" width="20px" style="padding:5px;"
src="https://cdn.simpleicons.org/apple/white" />
MacOs</a>
</li>
<li><a href="#git">
<img align="center" width="20px" style="padding:5px;"
src="https://cdn.simpleicons.org/git/red" />
Git</a>
<img align="center" width="20px" style="padding:5px;"
src="https://cdn.simpleicons.org/git/red" />
Git</a>
</li>
<li><a href="#adb">
<img align="center" width="20px" style="padding:5px;"
src="https://cdn.simpleicons.org/android/green" />
Adb</a>
<img align="center" width="20px" style="padding:5px;"
src="https://cdn.simpleicons.org/android/green" />
Adb</a>
</li>
<li><a href="#docker">
<img align="center" width="20px" style="padding:5px;"
src="https://cdn.simpleicons.org/docker" />
Docker</a>
</li>
<!-- <li><a href="#shellscript">
<img align="center" width="20px" style="padding:5px;" src="https://cdn.simpleicons.org/gnubash/white" />
Expand Down Expand Up @@ -124,6 +129,9 @@ <h1><u>
<div class="adb">
<zero-md class="app" src="./data/adbLearning.md"></zero-md>
</div>
<div class="docker">
<zero-md class="app" src="./data/docker.md"></zero-md>
</div>
<div class="batchscript">
<zero-md class="app" src="./data/batchscript.md"></zero-md>
</div>
Expand Down Expand Up @@ -152,6 +160,7 @@ <h1><u>
windows_it: 'Windows IT CMD Commands',
git: 'Git Basic Commands',
adb: 'ADB Basic Commands',
docker: 'Docker Basic Commands',
database: 'Database Basic Learning',
shellscript: 'Shell Script Commands',
batchscript: 'Batch Script Commands',
Expand All @@ -160,26 +169,26 @@ <h1><u>
about: "About"
};

// Show default active option after refresh/first-reload
var listItems = document.querySelectorAll('#myList li');
var cUrl = window.location.href;
var urlKey = cUrl.match(/(?<=\#)[a-z\-]+/gi);
if (urlKey) {
listItems.forEach((ele, index) => {
if (ele.textContent.match(/[a-z\-]+/gi).toString().toLowerCase() === urlKey.toString().toLowerCase()) {
var activeOption = ele.textContent ? ele.textContent.replace(/\s+/g, '') : '';
console.log('Active option: [Default] ' + activeOption);
listItems[index].classList.add('active')
showData(activeOption);
return;
}
});
} else {
var activeOption = listItems[0].textContent ? listItems[0].textContent.replace(/\s+/g, '') : '';
// Show default active option after refresh/first-reload
var listItems = document.querySelectorAll('#myList li');
var cUrl = window.location.href;
var urlKey = cUrl.match(/(?<=\#)[a-z\-]+/gi);
if (urlKey) {
listItems.forEach((ele, index) => {
if (ele.textContent.match(/[a-z\-]+/gi).toString().toLowerCase() === urlKey.toString().toLowerCase()) {
var activeOption = ele.textContent ? ele.textContent.replace(/\s+/g, '') : '';
console.log('Active option: [Default] ' + activeOption);
listItems[0].classList.add('active')
listItems[index].classList.add('active')
showData(activeOption);
return;
}
});
} else {
var activeOption = listItems[0].textContent ? listItems[0].textContent.replace(/\s+/g, '') : '';
console.log('Active option: [Default] ' + activeOption);
listItems[0].classList.add('active')
showData(activeOption);
}


listItems.forEach(function (item) {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"description": "",
"main": "index.js",
"scripts": {
"start": "http-server -p 12345 -c-1 -o",
"nodemon": "nodemon -x \"npm run start\""
"server": "http-server -p 12345 -c-1 -o",
"start": "nodemon -x \"npm run server\"",
"docker": "docker compose up"
},
"node-version": {
"node": "16.15.1"
Expand Down

0 comments on commit 1d565c8

Please sign in to comment.