K8S 虚拟化场景 常用命令
Check image history
docker history --format {{.CreatedBy}} --no-trunc=true $DockerImage |sed "s//bin/sh\ -c\ #(nop)\ //g"|sed "s//bin/sh\ -c/RUN/g" | tac
kubectl get nodes
kubectl get services
kubectl apply -f [deployment|service].yaml
docker build -t mynginx .
docker run -it --name xxx -v /root/xxx/:/workspace -p 8081:80 xxx/xxx
docker exec -it xxx /bin/bash
docker ps -a
docker images
docker image ls
docker run -it image_name
docker exec -it container_name
docker search centos
docker pull centos
docker history centos
docker save -o mynginx.tar mynginx 镜像迁移=离线获取镜像
docker load -i mynginx.tar
docker export vs import (容器导出为tar VS tar导入为镜像)
docker export -o ubuntu.tar f6f212ca3017
docker export -o export_xxx.tar 21c38d724788
docker import ubuntu.tar myubuntu #基于容器导出的tar构建镜像
docker commit (merge save/load/export/import) 使用容器创建镜像
docker commit e7856417a422 tesseract_xxx
docker save -o tesseract_xxx.tar tesseract_xxx
docker run -d -p 5555:22 --name tessxxx --privileged=true centos /usr/sbin/init
docker run --rm tesseract_xxx xxx -v
docker network ls
docker get nodes
docker get services
Stop exited container:
docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs docker rm
docker ps -a | grep Exit | awk '{ print $1}' | xargs sudo docker rm
docker rm $(docker ps --all -q -f status=exited)
curl -v --noproxy "*" -XGET http://localhost:8080/xxx/json/123321
nc -l 80 > rec.file
nc hostname 80 < send.file