Posts

Showing posts with the label Docker

Stop using third party packages that has many dependencies that the author didn't have a check before they use

33. "remove every backend project that uses node third party packages, they might has backdoor that could use your VPS as their VPS to act like a general web client for hackers"   it is even worse if you use npm in root VPS, because the npm will always use new version of a package or sub_package, how can you make sure your 3000 dependencies will not have a virus that could use your VPS root permission to do bad things?   it is the same for other package manager, for example, python pip. or golang package, java package, rust package, flutter package. in chinese, people usally call those machine that has those software running 'rou ji'. """ 利用 package manager 自动更新新版本的特性,做远控 轻而易举 就算不更新,利用现有的package,二进制文件或者脚本 一个post发到黑客服务器,它就知道你的电脑能不能被控制 对于root设备,被控制就是被完全控制,对于普通设备,就是被当成hacker web 客户端,可以被拿来在网上发垃圾信息、垃圾账号注册 到时候你的ip就会被当成坏ip被服务器墙掉 """

How to install docker and docker-compose in ubuntu 22.04 with one command

sudo apt install docker-compose ​

How to set up Ubuntu in Apple Macos m1/m2

Ubuntu SSH Server for The Stupid Apple Macos M1 System https://github.com/yingshaoxo/ubuntu_ssh_server_for_the_stupid_apple_macos_m1_system Build  Edit ssh_root_password environment variable in docker-compose.yaml file first. docker-compose.yaml: version: "3.9" services: 2_ssh_ubuntu: platform: linux/amd64 image: yingshaoxo/ubuntu_ssh_server_for_the_stupid_apple_macos_m1_system:v1 ports: - "2222:22" environment: - ssh_root_password=yingshaoxo volumes: - "~/ubuntu_docker:/root" restart: unless-stopped Run docker-compose up -d ssh root@ 127.0 . 0.1 -p 2222 The default password is yingshaoxo ​

How to get a Linux Desktop System by using docker-compose

version: '3.9' services: ubuntu-novnc: ports: - '6080:80' - '5900:5900' volumes: - '$pwd:/workspace:rw' environment: - USER=root - PASSWORD=root - HTTP_PASSWORD=root - VNC_PASSWORD=root - RESOLUTION=1920x1080 container_name: ubuntu-novnc image: 'fredblgr/ubuntu-novnc:22.04' HTTP Address: http://127.0.0.1:6080 VNC Address: vnc://127.0.0.1:5900  User: root Password: root For the volumes tag, the first part is the host folder, the second part is the container folder ​

How to export and import postgresql data

If you need to get into a docker container: docker exec -it ddc7665629f0 sh Export  pg_dump -U username database_name > ./test.pgsql Import psql -U username database_name < ./test.pgsql ​

How to use github actions to do CI/CD

1. create a file .github/workflows/node.js.yml name: Node.js CI on: push: branches: [ master ] pull_request: branches: [ master ] jobs: build: runs-on: ubuntu-latest steps: - uses: mskelton/setup-yarn@v1 - name: yarn install run: yarn install - name: yarn build run: yarn build - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.TOKEN }} publish_dir: ./dist 2. set GitHub secrets  https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-an-organization ​

minimum v2ray configuration

./data/v2ray/config.json  { " inbounds ": [ { " port ": 10000 , " listen ": "0.0.0.0" , " protocol ": "vmess" , " settings ": { " clients ": [ { " id ": "cc2d2564-e877-4f9f-959c-af373c1f91d6" , " alterId ": 64 , " security ": "auto" } ] } } ] , " outbounds ": [ { " protocol ": "freedom" , " settings ": {} } ] } docker-compose.yml version: "3.8" services: v2ray: image: v2fly/v2fly-core volumes: - ./data/v2ray:/etc/v2ray ports: - "10000:10000" restart: always client v2ray config address: Your ...

Get Started to use Kubernetes with the help of minikube

Introduction https://minikube.sigs.k8s.io/docs/start/ https://www.youtube.com/watch?v=IMOZCDhH7do Brief idea Container – In Minikube, containers are used as the building blocks of creating applications. Pod – Pod is a collection of one or more containers that share storage and network resources. Pods contain the definition of how the containers should be run in Minikube. Minikube uses these definitions to maintain the necessary resources. For example, you can define you need two pods. During execution, if a pod goes down, Minikube will automatically fire up a new pod. Deployments — I don’t know this yet: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/ Service – Because pods are replaceable, Minikube needs an abstraction layer to keep the interaction between the different pods seamless. For example, if a pod dies and a new pod is created, the application users shouldn’t get bogged down in the details of network addresses and related issues. Services ...

Use web-based transmission to download magnet-link

version: "2.1" services:   transmission:     image: linuxserver/transmission     container_name: transmission     environment:       - PUID=1000       - PGID=1000       - TZ=Europe/London       - TRANSMISSION_WEB_HOME=/combustion-release/ #optional       - USER=yingshaoxo #optional       - PASS=your_password #optional     volumes:       - /media/data1/transmission/config:/config       - /media/data1/transmission/downloads:/downloads       - /media/data1/transmission/watch:/watch     ports:       - 9091:9091       - 51413:51413       - 51413:51413/udp     restart: unless-stopped

Save, Load, Export, Import commands in Docker

1. save save image or images 2. load load image 3. export export container as an image 4. import import saved container (it's actually an image) 1. save sudo docker save -o images.img yingshaoxo/p4a yingshaoxo/mathchat yingshaoxo/tgask yingshaoxo/music_town 2. load sudo docker load --input images.img 3. export sudo docker export 69a780dc721a --output p4a.tar 4. import sudo docker import p4a.tar yingshaoxo/p4a:latest http://dockerlabs.collabnix.com/beginners/saving-images-as-tar/ https://docs.docker.com/engine/reference/commandline/save/ https://docs.docker.com/engine/reference/commandline/load/ https://docs.docker.com/engine/reference/commandline/container_export/ https://docs.docker.com/engine/reference/commandline/import/ https://medium.com/@sh.tsang/docker-tutorial-4-exporting-container-and-saving-image-c3a7d792cfb6

How to remove all unused containers and none images in docker (docker clean

sudo docker container prune sudo docker image prune sudo docker system prune -a 

Use docker-compose with Nginx to serve multiple domains to a single server (IP address)

Use docker-compose with Nginx github: https://github.com/yingshaoxo/yingshaoxo.github.io/tree/master/0.Powered_by_nginx Generate key  apt install certbot certbot certonly --standalone -d yingshaoxo.xyz Download your key for backup (1) tar -zcvf keys.tar.gz /etc/letsencrypt/live/ python3 -m http.server 8000 Download your key for backup (2) # Back to your local terminal wget your_server_ip:8000/keys.tar.gz #docker-compose.yml version: '3' services: nginx: image: nginx:latest container_name: nginx volumes: - ./nginx.conf:/etc/nginx/nginx.conf - /etc/letsencrypt/:/etc/letsencrypt/ ports: - 80:80 - 443:443 #nginx.conf worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_...