202304

docker命令行

2023年4月25日
202304
202304, docker

重要 # image是静态文件,container是运行在内存中的进程 容器内程序必须前台运行 网络 Bridge: default, single host, DNS, 因为有DNS,可以通过catainer name通讯 Host: only Linux, direct attach Overlay: multiple host 小部分容器管理可以使用compose,大规模使用k8s compose生产案例: http://github.com/datastaxdevs/docker-learning-path/tree/master/week-2 通过容器ID找到了容器在宿主机中的pid cat /sys/fs/cgroup/memory/docker/<containerId>/cgroup.procs 查看windows tcp端口限制 netsh interface ipv4 show excludedportrange protocol=tcp docker build # docker build . 构建image docker build -t <image-name>/<repo-name>:<tagname> . docker run # -publish/-p 开启host与容器内端口映射 docker run --publish 80:80/tcp <image> 前台运行 docker run --publish 80:80/tcp --detach <image> docker run --publish 80:80/tcp --d <image> -e ...

Dockerfile 常用指令

2023年4月24日
202304
202304, docker

Comment # #开头的为注释 Parse Directive # # directive=value1 不添加layer,影响Dockerfile 行的执行顺序 放在最开头 # escape=` 用在windows环境下解决反斜杠是路径分隔符的问题 FROM # FromImagename FROM [--platform=<platform>] <image> [AS <name>] FROM [--platform=<platform>] <image>[:<tag>] [AS <name>] FROM [--platform=<platform>] <image>[@<digest>] [AS <name>] ARG 可以出现在FROM前 FROM可以出现多次 ARG VERSION=latest # outside of build stageFROMbusybox:$VERSIONARG VERSION # 要使用FROM前的ARG,需要再像此一样重新声明一次RUN echo $VERSION > image_versionENV # ENV <key>=<value> 使用环境变量 ${variable} 或者 $variable, ${variable}_name更通用 ${variable:-word}, ${variable:+word} ...

wsl端口windows访问

2023年4月23日
202304
202304, wsl

wsl端口在windows通过localhost访问 # Now Microsoft will forward ports in linux by wslhost.exe when .wslconfig includes localhostForwarding=true (which is ture by default), see wsl-config. But, all those ports will only listen at local network on windows host, which means you can't access them from other devices in the same network. For now, wslpp will still open a same port listening at all interfaces, but if you don't need network access at this, you probably don't need wslpp at all, wslhost. ...

gdb

2023年4月2日
gdb
202304, gdb

gdb概览 # x/gx: 表示在以16进制方式查看内存时,以64位为单位(即8个字节)显示地址中的内容。例如,使用命令"x/gx 0x7fffffff"可以查看地址0x7fffffff处的8个字节内容 x/c: 表示在以16进制方式查看内存时,以字符形式显示地址中的内容。例如,使用命令"x/c 0x7fffffff"可以查看地址0x7fffffff处的一个字符内容 参考: https://github.com/fucking-translation/blog/blob/main/src/lang/rust/14-%E4%BD%BF%E7%94%A8GDB%E8%B0%83%E8%AF%95Rust%E5%BA%94%E7%94%A8.md