Open JayFate opened 1 year ago
# 停止容器 2139 2139
docker stop 2139 1e2a
# 删除容器
docker rm c3a2 b6d4 3363
# 停止并删除所有的容器
docker ps -aq | xargs docker stop | xargs docker rm
# 停止并删除所有的正在运行的容器
docker ps -q | xargs docker stop | xargs docker rm
# 进入容器
docker exec -it dda5 bash
docker build
来构建 web 应用https://docker-training-labs.readthedocs.io/en/latest/01-getting-started/docker-machine-commands.html
docker-comopse up
, docker-comopse start
, docker-comopse restart
的区别
https://blog.csdn.net/wangooo/article/details/109362673
https://stackoverflow.com/questions/33715499/what-is-the-difference-between-docker-compose-up-and-docker-compose-start
一个可以直接使用的 docker-compose.yml
version: '3.7'
volumes:
wp-data:
networks:
wp-back:
services:
db:
image: mysql:5.7
volumes:
- wp-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: rootPassword
MYSQL_DATABASE: wordpress
MYSQL_USER: wp-user
MYSQL_PASSWORD: wp-pass
ports:
- 8889:3306
networks:
- wp-back
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
environment:
PMA_HOST: db
MYSQL_USER: wp-user
MYSQL_PASSWORD: wp-pass
MYSQL_ROOT_PASSWORD: rootPassword
ports:
- 3001:80
networks:
- wp-back
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- 8888:80
- 443:443
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wp-user
WORDPRESS_DB_PASSWORD: wp-pass
volumes:
- ./wordpress-files:/var/www/html
container_name: wordpress-site
networks:
- wp-back
https://www.jianshu.com/p/18108c28ec1b https://blog.csdn.net/m0_37605642/article/details/124330514
https://www.linuxmi.com/docker-run-mysql.html
{
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"registry-mirrors": [
"https://docker.mirrors.ustc.edu.cn",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com"
],
"experimental": false,
"features": {
"buildkit": true
}
}
运行以下命令启动容器,并将本地的docker-training目录内容挂接到容器内的docker-training目录中。
docker run -it -v d:/docker-training:/docker-training ubuntu /bin/bash
docker run --rm ba-208
# --rm 在容器退出时就能够自动清理容器内部的文件系统,--rm选项不能与-d同时使用
docker logs -f 34f7
# 获取容器日志并实时输出
https://docker-training-labs.readthedocs.io/en/latest/03-common-challenges/docker-monitor.html
docker-compose 示例 docker-file 示例
https://www.linuxmi.com/docker-bushu-ghost.html https://computingforgeeks.com/how-to-run-ghost-cms-in-docker-containers/ https://draft.dev/learn/running-ghost-on-docker-for-your-developer-blog
https://juejin.cn/post/6844904004296638478
解决办法:
1,在拷贝前输入:set paste (这样的话,vim就不会启动自动缩进,而只是纯拷贝粘贴)
2,拷贝完成之后,输入:set nopaste (关闭paste)
vscode同时编辑多处文字 批量替换编辑内容 https://blog.csdn.net/woshidamimi0/article/details/84560982
你也可以查看所有的容器,包括没有在运行状态的容器,使用
docker ps -a
命令