Docker

111次阅读

共计 920 个字符,预计需要花费 3 分钟才能阅读完成。

docker 基础知识

docker 三大件:镜像、容器、仓库
镜像:
docker pull [选项] [Docker Registry 地址 [: 端口号]/] 仓库名[: 标签]
docker image ls—列出本地已存在的镜像
docker image ls -f dangling=true—dangling 表示虚悬镜像
docker system df—查看镜像、容器、数据卷所占用的空间
docker image ls --format "{{.ID}}: {{.Repository}}"—利用 go 语言列出想要的列
docker image rm—有可能仅仅是取消了某个标签而已

docker image rm $(docker image ls -q -f before=mongo:3.2)—配合使用

充分利用你的想象力和 Linux 命令行的强大

容器
docker container start '容器 id'
docker run --rm -it -d -p80:80 vulnerables/web-dvwa
docker logs '容器 id'—查看日志
docker container ls=docker ps

进入容器
docker exec -it '容器 id' bash—exit 不会导致容器停止,推荐使用
docker attach '容器 id'—exit 会导致容器停止
docker cp /www/runoob 96f7f14e99ab:/www/
docker cp 96f7f14e99ab:/www/ /www/runoob
仓库
docker search
docker login——sunxiine、xiang@123
docker push 'REPOSITORY':'TAG'

docker 数据管理

1. 数据卷
2. 挂载主机目录

docker 网络

docker network create -d bridge net-name
docker run -it --rm --name busybox2 --network my-net busybox

在容器中安装 ping 命令

docker run 'image' apt-get install -y ping
运行上条命令可能会提示找不到 '包',然后运行
apt-get update

docker commit

docker commit '容器 id' 创建一个新镜像

正文完
 0

docker

111次阅读

共计 30 个字符,预计需要花费 1 分钟才能阅读完成。

docker build
docker-compose build

正文完
 0

docker

111次阅读

共计 953 个字符,预计需要花费 3 分钟才能阅读完成。

  • Linux 常用操作

    • 清除缓存:echo 1 > /proc/sys/vm/drop_caches
    • 杀死进程:kill -9 ps -ef |grep tomcat | awk '{print $2,$3}'
    • Centos 7 查看防火墙状态:firewall-cmd --state
    • Centos 7 一次性关闭防火墙:systemctl stop firewalld.service
    • yum 清除缓存:yum makecache
    • 查看版本:cat /etc/redhat-release
    • 查看可以安装的软件版本 (比如 mysql):yum list | grep mysql
    • 同时安装多个软件(比如 mysql):yum install -y mysql-server mysql mysql-devel
    • 查看软件版本(比如 mysql):rpm -qi mysql-server
    • 查看已经安装的软件(比如 mysql):rpm -qa | grep mysql
    • 卸载软件:rpm -e mysql // 普通删除模式
    • 卸载软件:rpm -e –nodeps mysql // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除
    • 检查软件是否是开机启动:chkconfig –list | grep mysqld
    • 设置软件开机启动:chkconfig mysqld on
    • 在一行前新增一行数据:sed -in-place ‘1i nihaxxxoya’ test.sh
    • 在一行后新增一行数据:sed -in-place ‘1a nihaxxxoya’ test.sh
    • 获取当前登录的用户 echo $(whoami)
    • 查看公网 ipcurl cip.cc
    • 设置免密登陆服务器 ssh-copy-id -i id_rsa.pub root@192.168.136.211
    • curl localhost:9999/api/daizhige/article -X POST -H “Content-Type:application/json” -d ‘”title”:”comewords”,”content”:”articleContent”‘
    • tcpdump -A -s 0 ‘tcp port 9200 and (((ip[2:2] – ((ip[0]&0xf)<<2)) – ((tcp[12]&0xf0)>>2)) != 0) and host 110.184.155.52’ -vv
正文完
 0

docker

111次阅读

共计 953 个字符,预计需要花费 3 分钟才能阅读完成。

  • Linux 常用操作

    • 清除缓存:echo 1 > /proc/sys/vm/drop_caches
    • 杀死进程:kill -9 ps -ef |grep tomcat | awk '{print $2,$3}'
    • Centos 7 查看防火墙状态:firewall-cmd --state
    • Centos 7 一次性关闭防火墙:systemctl stop firewalld.service
    • yum 清除缓存:yum makecache
    • 查看版本:cat /etc/redhat-release
    • 查看可以安装的软件版本 (比如 mysql):yum list | grep mysql
    • 同时安装多个软件(比如 mysql):yum install -y mysql-server mysql mysql-devel
    • 查看软件版本(比如 mysql):rpm -qi mysql-server
    • 查看已经安装的软件(比如 mysql):rpm -qa | grep mysql
    • 卸载软件:rpm -e mysql // 普通删除模式
    • 卸载软件:rpm -e –nodeps mysql // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除
    • 检查软件是否是开机启动:chkconfig –list | grep mysqld
    • 设置软件开机启动:chkconfig mysqld on
    • 在一行前新增一行数据:sed -in-place ‘1i nihaxxxoya’ test.sh
    • 在一行后新增一行数据:sed -in-place ‘1a nihaxxxoya’ test.sh
    • 获取当前登录的用户 echo $(whoami)
    • 查看公网 ipcurl cip.cc
    • 设置免密登陆服务器 ssh-copy-id -i id_rsa.pub root@192.168.136.211
    • curl localhost:9999/api/daizhige/article -X POST -H “Content-Type:application/json” -d ‘”title”:”comewords”,”content”:”articleContent”‘
    • tcpdump -A -s 0 ‘tcp port 9200 and (((ip[2:2] – ((ip[0]&0xf)<<2)) – ((tcp[12]&0xf0)>>2)) != 0) and host 110.184.155.52’ -vv
正文完
 0

docker

111次阅读

共计 953 个字符,预计需要花费 3 分钟才能阅读完成。

  • Linux 常用操作

    • 清除缓存:echo 1 > /proc/sys/vm/drop_caches
    • 杀死进程:kill -9 ps -ef |grep tomcat | awk '{print $2,$3}'
    • Centos 7 查看防火墙状态:firewall-cmd --state
    • Centos 7 一次性关闭防火墙:systemctl stop firewalld.service
    • yum 清除缓存:yum makecache
    • 查看版本:cat /etc/redhat-release
    • 查看可以安装的软件版本 (比如 mysql):yum list | grep mysql
    • 同时安装多个软件(比如 mysql):yum install -y mysql-server mysql mysql-devel
    • 查看软件版本(比如 mysql):rpm -qi mysql-server
    • 查看已经安装的软件(比如 mysql):rpm -qa | grep mysql
    • 卸载软件:rpm -e mysql // 普通删除模式
    • 卸载软件:rpm -e –nodeps mysql // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除
    • 检查软件是否是开机启动:chkconfig –list | grep mysqld
    • 设置软件开机启动:chkconfig mysqld on
    • 在一行前新增一行数据:sed -in-place ‘1i nihaxxxoya’ test.sh
    • 在一行后新增一行数据:sed -in-place ‘1a nihaxxxoya’ test.sh
    • 获取当前登录的用户 echo $(whoami)
    • 查看公网 ipcurl cip.cc
    • 设置免密登陆服务器 ssh-copy-id -i id_rsa.pub root@192.168.136.211
    • curl localhost:9999/api/daizhige/article -X POST -H “Content-Type:application/json” -d ‘”title”:”comewords”,”content”:”articleContent”‘
    • tcpdump -A -s 0 ‘tcp port 9200 and (((ip[2:2] – ((ip[0]&0xf)<<2)) – ((tcp[12]&0xf0)>>2)) != 0) and host 110.184.155.52’ -vv
正文完
 0

docker

111次阅读

共计 953 个字符,预计需要花费 3 分钟才能阅读完成。

  • Linux 常用操作
  • 清除缓存:echo 1 > /proc/sys/vm/drop_caches
  • 杀死进程:kill -9 ps -ef |grep tomcat | awk '{print $2,$3}'
  • Centos 7 查看防火墙状态:firewall-cmd --state
  • Centos 7 一次性关闭防火墙:systemctl stop firewalld.service
  • yum 清除缓存:yum makecache
  • 查看版本:cat /etc/redhat-release
  • 查看可以安装的软件版本 (比如 mysql):yum list | grep mysql
  • 同时安装多个软件(比如 mysql):yum install -y mysql-server mysql mysql-devel
  • 查看软件版本(比如 mysql):rpm -qi mysql-server
  • 查看已经安装的软件(比如 mysql):rpm -qa | grep mysql
  • 卸载软件:rpm -e mysql // 普通删除模式
  • 卸载软件:rpm -e –nodeps mysql // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除
  • 检查软件是否是开机启动:chkconfig –list | grep mysqld
  • 设置软件开机启动:chkconfig mysqld on
  • 在一行前新增一行数据:sed -in-place ‘1i nihaxxxoya’ test.sh
  • 在一行后新增一行数据:sed -in-place ‘1a nihaxxxoya’ test.sh
  • 获取当前登录的用户 echo $(whoami)
  • 查看公网 ipcurl cip.cc
  • 设置免密登陆服务器 ssh-copy-id -i id_rsa.pub root@192.168.136.211
  • curl localhost:9999/api/daizhige/article -X POST -H “Content-Type:application/json” -d ‘”title”:”comewords”,”content”:”articleContent”‘
  • tcpdump -A -s 0 ‘tcp port 9200 and (((ip[2:2] – ((ip[0]&0xf)<<2)) – ((tcp[12]&0xf0)>>2)) != 0) and host 110.184.155.52’ -vv
正文完
 0