Windows 10 专业版 开发主机搭建docker开发调试环境
“`bash
# 初始化容器管理节点
docker swarm init
docker node ls
docker network ls
# 创建覆盖网络
docker network create ^
–attachable ^
–subnet 10.0.10.0/24 ^
–driver overlay ^
dev_local
# 创建一个 helloworld 服务
docker service create ^
–replicas 1 ^
–name helloworld ^
–network=dev_local ^
alpine:3.7 ^
ping www.baidu.com
docker service rm helloworld
# 为 your-dev-pc 主机设置节点标签
docker node ls
docker node update –label-add host=your-dev-pc nm52bvv41i6ts7xgsq4zi1q6g
docker login registry.cn-shenzhen.aliyuncs.com
docker build ^
d:/data/config/local/nginx ^
-t registry.cn-shenzhen.aliyuncs.com/your-co-name/nginx:latest
docker push registry.cn-shenzhen.aliyuncs.com/your-co-name/nginx:latest
docker stack ^
deploy ^
-c d:/data/config/local/nginx/docker-compose.yml ^
nginx
“`
“`bash
# 本机部署 www_dev_cms
docker stack ^
deploy ^
–with-registry-auth ^
-c d:/data/config/site-cms/www_dev_local/docker-compose.yml ^
www-dev-cms
“`
“`bash
# 本机部署 www_dev_api
docker build ^
d:/data/config/api/base_with_xdebug ^
-t registry.cn-shenzhen.aliyuncs.com/your-co-name/api-base-with-xdebug:latest
docker push registry.cn-shenzhen.aliyuncs.com/your-co-name/api-base-with-xdebug:latest
docker build ^
d:/data/config/api/sp_dev_local ^
-t registry.office.your-co-name.cn/sp-dev-api-with-xdebug:latest
docker push registry.office.your-co-name.cn/sp-dev-api-with-xdebug:latest
docker stack ^
deploy ^
–with-registry-auth ^
-c d:/data/config/api/sp_dev_local/docker-compose.yml ^
sp-dev-api
“`
# 本机设置 gitlab-runner
“`bash
# your-dev-pc
docker build ^
d:/data/config/local/gitlab-runner ^
-t registry.cn-shenzhen.aliyuncs.com/your-co-name/gitlab-runner:latest
docker push registry.cn-shenzhen.aliyuncs.com/your-co-name/gitlab-runner:latest
docker stack rm gitlab-runner
docker stack ^
deploy ^
-c d:/data/config/local/gitlab-runner/docker-compose.yml ^
gitlab-runner
docker ps -q -f name=gitlab-runner_app
docker exec -it 48025f710dfc gitlab-runner register
“`