惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
月光博客
月光博客
IT之家
IT之家
B
Blog RSS Feed
T
Tailwind CSS Blog
The GitHub Blog
The GitHub Blog
博客园 - 三生石上(FineUI控件)
MyScale Blog
MyScale Blog
J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - Franky
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
博客园_首页
B
Blog
V
V2EX
腾讯CDC
Vercel News
Vercel News
量子位
Microsoft Security Blog
Microsoft Security Blog

mafeifan 的编程技术分享

mafengwo-mp3-downloader | mafeifan 的编程技术分享 示例页面 | mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 查看 default namespace 下的 default service account名称 mafeifan 的编程技术分享 检查日志 | mafeifan 的编程技术分享 bridge fdb show dev flannel.1 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享 mafeifan 的编程技术分享
mafeifan 的编程技术分享
2026-01-16 · via mafeifan 的编程技术分享

免sudo执行docker和docker-compose ​

官方文档 有介绍

bash

# 创建名为docker的用户组
sudo groupadd docker
# 把当前用户加入到这个用户组中
sudo usermod -aG docker $USER
# 重登session
# 测试,不带sudo跑一个测试镜像
docker run hello-world

跟随系统自自动docker ​

sudo systemctl enable docker

  • Docker Machine 的目的是简化 Docker 的安装和远程管理。 通过 docker-machine 命令我们可以轻松的在远程主机上安装 Docker。
  • pull 镜像的时候最好指定tag,不然默认会用latest。会导致版本问题。 如 pull mysql 会拉最新的8.0
  • CMD echo $HOME , 在实际执行中,会将其变更为:CMD [ "sh", "-c", "echo $HOME" ], 所以 CMD service nginx start 不对,要使用 CMD ["nginx", "-g", "daemon off;"]

docker build 会加入上下文 如果加入

.dockerignore 指定忽略目录文件

实用的命令 ​

根据容器名称查询容器ID并删除

# 第一种写法

docker stop `docker ps -a| grep test-project | awk '{print $1}' `
docker rm   `docker ps -a| grep test-project | awk '{print $1}' `

# 第二种写法
docker stop  `docker ps -aq --filter name=test-project`
docker rm    `docker ps -aq --filter name=test-project`

根据镜像名称查询容器ID并删除

# 第一种写法
docker stop `docker ps -a| grep ygsama/test-project:1.0.2 | awk '{print $1}' `
docker rm   `docker ps -a| grep ygsama/test-project:1.0.2 | awk '{print $1}' `

# 第二种写法
docker stop  `docker ps -aq --filter ancestor=ygsama/test-project:1.0.2`
docker rm   `docker ps -aq --filter ancestor=ygsama/test-project:1.0.2`

根据镜像名称查询镜像ID并删除

docker images -q --filter reference=ygsama/test-project*:*
docker image rm `docker images -q --filter reference=10.2.21.95:10001/treasury-brain*:*`

docker-compose ​

  1. env问题
  2. 重启 php-fpm
  3. 慎用 docker-compose down
  4. 环境变量 优先级 shell > .env
  5. 执行 docker-compose up 之前执行先执行 docker-compose config就是把实际要运行的docker-compose.yml内容打印出来

Windows 操作系统底下经常会有文件字符集问题,比如报 <input>:1:13: illegal character NUL,需要转换成unix文件格式 可以打开 git bash 运行 dos2unix 后跟文件名

参考: