docker-compose 使用总结

 

docker-compose + yaml 发布系统:使用总结

1.下载安装docker-compose
下载
curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

2.授权:
chmod +x /usr/local/bin/docker-compose

3.查看docker-compose 版本
docker-compose –version

4.查看docker-compose 命令
docker-compose –commands

5.停止docker-compose
docker-compose stop

6.删除所有容器
docker stop $(dcoker ps -q) & docker -rm $(docker ps -aq)

7.docker-compose up -d #运行docker-compose.yaml,进入文件所在的目前执行up

bgsave -redis

 

8.docker-compose.yaml:  www.toyaml.com 编辑工具,vs2022编辑工具

version: '3.3'
services:
service1:
build:
context: /vip/file/Zhaoxi.AspNetCore31.DockerProject
image: composecore31v4.3
ports:
- 8081:80/tcp
service2:
image: composecore31v4.3
ports:
- 8082:80/tcp
command: ["dotnet", "/app/Zhaoxi.AspNetCore31.DockerProject.dll"]
nginx:
image: nginx:latest
ports:
- 8086:80/tcp
volumes:
- /vip/enginx/nginx.conf:/etc/nginx/nginx.conf
redis:
image: redis:6.0
ports:
- 8085:6380/tcp
volumes:
- /vip/eredis/redis.conf:/usr/local/etc/redis/redis.conf
- /vip/eredis/data:/data:rw
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]

 

9.docker file--------------------

周永光 MVP
windows server 2016
windowsservercore
nanoservr

windows Containers
Hyper-V Containers

docker build -t core31v1.10.1 -f Dockerfile .

docker build -t core31v110.8081 -f Dockerfile .

docker images
docker rmi imagesid

docker run -itd -p 8082:80 core31v110.01 #d 后台执行

docker logs 83c1s

 

10.dockerHub ----------------------------------------

1.发布的程序文件+官方CLR镜像
2.用dockerfile去构建镜像,容器

docker pull nginx
dcoker run -d nginx

docker exec -it 4e65e /bin/bash
cd nginx
cat nginx.conf

docker run -d -p 8086:80 -v /vip/enginx/:/var/log/nginx/ -v /vip/enginx/nginx.conf:/etc/nginx/nginx.conf:ro --name elnginx nginx

 

##ro 申请权限

​https://hub.docker.com​