小白如何优雅部署及管理Docker服务

小白如何优雅部署及管理Docker服务

  • 在Docker中创建一个名为 nginx_net 的网络
docker network create nginx_net
version: "3.8"
networks:
  nginx_net:
    external: true
services:
  dockge:
    image: louislam/dockge:1
    container_name: dockge
    restart: unless-stopped
    networks:
      - nginx_net
    ports:
      # Host Port : Container Port
      - 5001:5001
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./data:/app/data
        
      # If you want to use private registries, you need to share the auth file with Dockge:
      # - /root/.docker/:/root/.docker

      # Stacks Directory
      # ⚠️ READ IT CAREFULLY. If you did it wrong, your data could end up writing into a WRONG PATH.
      # ⚠️ 1. FULL path only. No relative path (MUST)
      # ⚠️ 2. Left Stacks Path === Right Stacks Path (MUST)
      - ./stacks:/opt/stacks
    environment:
      # Tell Dockge where is your stacks directory
      - DOCKGE_STACKS_DIR=/opt/stacks
version: '3.8'
networks:
  nginx_net:
    external: true
services:
  nginx-proxy-manager:
    image: 'jc21/nginx-proxy-manager:latest'
    container_name: nginx-proxy-manager
    restart: unless-stopped
    networks:
      - nginx_net
    ports:
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
    environment:
      DISABLE_IPV6: 'true'
    volumes:
      - /opt/nginx-proxy-manager/data:/data
      - /opt/nginx-proxy-manager/letsencrypt:/etc/letsencrypt

DNS解析时主域名填写服务器IP,二级域名CNAME指向主域名,nginx-proxy-manger里填写compose文件中容器名和容器内端口就可以了(注意容器要和nginx-proxy-manger在同一网络)

以上为个人部署和管理Docker服务步骤(仅供参考),如有不足还请指出

安装完这两个应用就可以愉快地部署其他Docker服务啦

4 个赞

宝塔,无脑上,傻瓜式使用

感谢教程

学习学习

我一般不光指定docker网络,我还指定每个docker的地址。其他容器间用Ip地址来通讯

不是应该装个k8s吗?

1 个赞

俺不会捏:tieba_066:

大佬,请教一下这两个服务具体是用来做什么的啊,我一直都是直接部署其他docker服务的

shell脚本梭哈的路过。

都是图形化界面管理,Dockge管理Docker容器,直接界面安装、重启和更新Docker服务,npm用来反代,上手简单,我已经全部用Dockge来管理了

好的好的,谢谢佬的回复,祝周末愉快^ ^