为八达通配置docker服务的问题

问题描述

我正在尝试使用docker-compose配置带有轮询和监听触手的八达通服务器,但是出现问题。

以下是我的设置

  1. 用于Windows的docker
  2. WSL2
  3. 运行基于linux的容器

版本1:一起运行所有服务。

version: '3.7'

services:
  db:
    image: mcr.microsoft.com/mssql/server:${sql_SERVER_TAG}
    container_name: octo_sql
    environment:
      ACCEPT_EULA: Y
      SA_PASSWORD: ${sql_SA_PASSWORD}
    ports:
      - 30070:1433
    restart: unless-stopped

  octo:
    image: octopusdeploy/octopusdeploy:${OCTOPUS_SERVER_TAG}
    container_name: octo_server
    depends_on:
      - db
    ports:
      - 30071:8080
      - 30072:10943
    environment:
      ACCEPT_EULA: Y
      ACCEPT_OCTOPUS_EULA: Y
      ADMIN_USERNAME: ${OCTOPUS_ADMIN_USERNAME}
      ADMIN_PASSWORD: ${OCTOPUS_ADMIN_PASSWORD}
      ADMIN_EMAIL: ${OCTOPUS_ADMIN_EMAIL}
      ADMIN_API_KEY: ${ADMIN_API_KEY}
      DB_CONNECTION_STRING: ${OCTOPUS_sql_CONNECTION_STRING}
      OCTOPUS_SERVER_NODE_NAME: ${OCTOPUS_SERVER_NODE_NAME}
      OCTOPUS_SERVER_BASE64_LICENSE: ${OCTOPUS_SERVER_BASE64_LICENSE}
      MASTER_KEY: ${OCTOPUS_MASTER_KEY}
      disABLE_dind: Y
    volumes:
      - "/server/Artifacts:/artifacts"
      - "/server/Cache:/cache"
      - "/server/Import:/import"
      - "/server/Repository:/repository"
      - "/server/TaskLogs:/taskLogs"
    restart: unless-stopped
    
  mail:
    image: mailhog/mailhog:latest
    container_name: octo-mail-server
    depends_on:
      - octo
    ports:
      - 30073:1025
      - 30074:8025
    restart: unless-stopped

  octo_listenting_tentacle:
    image: octopusdeploy/tentacle:${OCTOPUS_TENTACLE_TAG}
    container_name: octo_listenting_tentacle
    ports:
      - 30075:10933
    environment:
      ACCEPT_EULA: Y
      ServerUrl: "http://localhost:30071"
      ServerApiKey: "${OCTOPUS_API_KEY}"
      ServerUsername: "${OCTOPUS_ADMIN_USERNAME}"
      ServerPassword: "${OCTOPUS_ADMIN_PASSWORD}" 
      TargetEnvironment: "${OCTOPUS_ENVIRONMENT}"
      TargetRole: "app-server"
      ListeningPort: "30075"
    volumes:
      - "/octopus/listening_tentacle:/applications"
    restart: unless-stopped  
    
  octo_polling_tentacle:
    image: octopusdeploy/tentacle:${OCTOPUS_TENTACLE_TAG}
    container_name: octo_polling_tentacle
    environment:
      ACCEPT_EULA: Y
      ServerUrl: "http://localhost:30071"
      ServerApiKey: "${OCTOPUS_API_KEY}"
      ServerUsername: "${OCTOPUS_ADMIN_USERNAME}"
      ServerPassword: "${OCTOPUS_ADMIN_PASSWORD}"
      TargetEnvironment: "${OCTOPUS_ENVIRONMENT}"
      TargetRole: "web-server"
      ServerPort: "30072"
    volumes:
      - "/octopus/polling_tentacle:/applications"
    restart: unless-stopped

.env文件

sql_SERVER_TAG=2017-latest
sql_SA_PASSWORD=Your_password123    
OCTOPUS_SERVER_TAG=latest
OCTOPUS_TENTACLE_TAG=latest    
OCTOPUS_ENVIRONMENT=Development    

OCTOPUS_sql_CONNECTION_STRING=Server=db,1433;Initial Catalog=Octopus;Persist Security Info=False;User ID=sa;Password=Your_password123;MultipleActiveResultSets=False;Connection Timeout=30; 

OCTOPUS_SERVER_NODE_NAME=octo_server
OCTOPUS_SERVER_BASE64_LICENSE=

OCTOPUS_MASTER_KEY=i1ny61OiWPdRCxBYhCtlug==

OCTOPUS_ADMIN_USERNAME=admin
OCTOPUS_ADMIN_PASSWORD=p@$$0Rd;-

OCTOPUS_ADMIN_EMAIL=

OCTOPUS_API_KEY=API-DWIGEMBOOR8KH0JPDBGOVJ8LQQ

运行容器时,触手无法这样做,因此保持在“正在重新启动”状态

以下是输出

应用程序目录设置为:/ home / Octopus / Applications Tentacle将 不监听端口这些更改要求重新启动触手。

  • 触手注册工人-实例触手-服务器http:// localhost:30071-名称ff035183962b-通信样式 TentacleActive-服务器通信端口30072 --apiKey API-DWIGEMBOOR8KH0JPDBGOVJ8LQQ --space Default'--workerpool =认 Worker Pool''--policy =认机器策略'--force检查 服务器通讯端口30072上的连接...

{0}失败,并显示消息{1)。在{4}中重试({2} / {3})。 (检查 服务器通信已打开,无法分配请求的地址无法 分配请求的地址,4,5,00:00:02.5312500)=>输入字符串不是 以正确的格式。 System.Net.WebException:无法分配请求 地址无法分配请求的地址 ---> System.Net.Http.HttpRequestException:无法分配请求的地址 ---> System.Net.sockets.socketException(99):无法在System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32端口,CancellationToken cancelToken() ---内部异常堆栈跟踪的结尾---在System.Net.Http.ConnectHelper.ConnectAsync(String host,Int32 port, CancellationToken cancelToken() System.Net.Http.httpconnectionPool.ConnectAsync(HttpRequestMessage 请求,布尔值allowHttp2,CancellationToken cancelToken)在 System.Net.Http.httpconnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage 的请求,在 System.Net.Http.httpconnectionPool.GethttpconnectionAsync(HttpRequestMessage 的请求,在 System.Net.Http.httpconnectionPool.SendWithRetryAsync(HttpRequestMessage 请求,布尔值doRequestAuth,CancelationToken cancelToken) 在System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage 的请求,在 System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage请求,CancellationTokenSource cts,布尔值 disposeCts)位于System.Net.HttpWebRequest.SendRequest()处 System.Net.HttpWebRequest.GetResponse() -内部异常堆栈跟踪的结尾--在System.Net.HttpWebRequest.GetResponse() 章鱼。触手通信.OctopusServerChecker。 c__displayClass2_0.b__1() 在 /opt/TeamCity/BuildAgent/work/e5cfddd118f4e691/source/Octopus.Tentacle/Communications/OctopusServerChecker.cs:line 48岁 Octopus.Tentacle.Communications.OctopusServerChecker.Retry(String actionDescription,Action操作,Int32 retryCount,TimeSpan initialDelay,Double backOffFactor)在 /opt/TeamCity/BuildAgent/work/e5cfddd118f4e691/source/Octopus.Tentacle/Communications/OctopusServerChecker.cs:line 85

有关触手的更多信息

                               --Inner Exception--
octo_polling_tentacle       | Cannot assign requested address
octo_polling_tentacle       | System.Net.Http.HttpRequestException
octo_polling_tentacle       |    at System.Net.Http.ConnectHelper.ConnectAsync(String host,Int32 port,CancellationToken cancellationToken)
octo_polling_tentacle       |    at System.Net.Http.httpconnectionPool.ConnectAsync(HttpRequestMessage request,Boolean allowHttp2,CancellationToken cancellationToken)
octo_polling_tentacle       |    at System.Net.Http.httpconnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request,CancellationToken cancellationToken)
octo_polling_tentacle       |    at System.Net.Http.httpconnectionPool.GethttpconnectionAsync(HttpRequestMessage request,CancellationToken cancellationToken)
octo_polling_tentacle       |    at System.Net.Http.httpconnectionPool.SendWithRetryAsync(HttpRequestMessage request,Boolean doRequestAuth,CancellationToken cancellationToken)
octo_polling_tentacle       |    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
octo_polling_tentacle       |    at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask,HttpRequestMessage request,CancellationTokenSource cts,Boolean disposeCts)
octo_polling_tentacle       |    at System.Net.HttpWebRequest.SendRequest()
octo_polling_tentacle       |    at System.Net.HttpWebRequest.GetResponse()
octo_polling_tentacle       |
octo_polling_tentacle       | --Inner Exception--
octo_polling_tentacle       | Cannot assign requested address
octo_polling_tentacle       | System.Net.sockets.socketException
octo_polling_tentacle       |    at System.Net.Http.ConnectHelper.ConnectAsync(String host,CancellationToken cancellationToken)
octo_polling_tentacle       | -------------------------------------------------------------------------------
octo_polling_tentacle       | Terminating process with exit code 100
octo_polling_tentacle       | Full error details are available in the log files at:
octo_polling_tentacle       | /etc/octopus/Logs
octo_polling_tentacle       | Octopus/Logs
octo_polling_tentacle       | If you need help,please send these log files to https://octopus.com/support
octo_polling_tentacle       | -------------------------------------------------------------------------------
octo_polling_tentacle       |
octo_polling_tentacle       | + [[ Y != \Y ]]
octo_polling_tentacle       | + '[' -f /usr/bin/tentacle ']'
octo_polling_tentacle       | + echo 'Octopus Tentacle is already configured.'
octo_polling_tentacle       | + return
octo_polling_tentacle       | /scripts/configure-tentacle.sh: line 16: return: can only `return' from a function or sourced script
octo_polling_tentacle       | Octopus Tentacle is already configured.
octo_polling_tentacle       | + [[ Y != \Y ]]
octo_polling_tentacle       | + '[' -f /usr/bin/tentacle ']'
octo_polling_tentacle       | + echo 'Octopus Tentacle is already configured.'
octo_polling_tentacle       | + return
octo_polling_tentacle       | /scripts/configure-tentacle.sh: line 16: return: can only `return' from a function or sourced script
octo_polling_tentacle       | Octopus Tentacle is already configured.

我的第二次尝试是将文件分割成两个docker-compose文件。 服务器

version: '3.7'

services:
  db:
    image: mcr.microsoft.com/mssql/server:${sql_SERVER_TAG}
    container_name: octo_sql
    environment:
      ACCEPT_EULA: ${ACCEPT_EULA}
      SA_PASSWORD: ${sql_SA_PASSWORD}
    restart: unless-stopped

  octo:
    image: octopusdeploy/octopusdeploy:${OCTOPUS_SERVER_TAG}
    container_name: octo_server
    depends_on:
      - db
    ports:
      - 81:8080
      - 10943:10943
    environment:
      ACCEPT_EULA: ${ACCEPT_EULA}
      ACCEPT_OCTOPUS_EULA: ${ACCEPT_EULA}
      ADMIN_USERNAME: ${OCTOPUS_ADMIN_USERNAME}
      ADMIN_PASSWORD: ${OCTOPUS_ADMIN_PASSWORD}
      ADMIN_EMAIL: ${OCTOPUS_ADMIN_EMAIL}
      # ADMIN_API_KEY: ${OCTOPUS_ADMIN_API_KEY}
      DB_CONNECTION_STRING: ${sql_CONNECTION}
      OCTOPUS_SERVER_NODE_NAME: ${OCTOPUS_SERVER_NODE_NAME}
      OCTOPUS_SERVER_BASE64_LICENSE: ${OCTOPUS_SERVER_BASE64_LICENSE}
      MASTER_KEY: ${OCTOPUS_MASTER_KEY}
    volumes:
      - "/server/Artifacts:/artifacts"
      - "/server/Cache:/cache"
      - "/server/Import:/import"
      - "/server/Repository:/repository"
      - "/server/TaskLogs:/taskLogs"
    restart: unless-stopped
    
  mail:
    image: mailhog/mailhog:latest
    container_name: octo-mail-server
    depends_on:
      - octo
    ports:
      - 30073:1025
      - 30074:8025
    restart: unless-stopped
服务器的

.env文件

ACCEPT_EULA=Y

sql_SERVER_TAG=2017-latest
sql_SA_PASSWORD=Your_password123    
sql_CONNECTION=Server=db,1433;Initial Catalog=Octopus;Persist Security Info=False;User ID=sa;Password=Your_password123;MultipleActiveResultSets=False;Connection Timeout=30; 

OCTOPUS_ENVIRONMENT=Development    

OCTOPUS_SERVER_TAG=latest
OCTOPUS_ADMIN_USERNAME=admin
OCTOPUS_ADMIN_PASSWORD=p@$$0Rd;-
OCTOPUS_SERVER_NODE_NAME=octo_server
OCTOPUS_MASTER_KEY=i1ny61OiWPdRCxBYhCtlug==

OCTOPUS_ADMIN_EMAIL=
OCTOPUS_ADMIN_API_KEY=
OCTOPUS_SERVER_BASE64_LICENSE=

触手

version: '3.7'

services:
  # octo_listenting_tentacle:
  #   image: octopusdeploy/tentacle:${OCTOPUS_TENTACLE_TAG}
  #   container_name: octo_listenting_tentacle
  #   ports:
  #     - 10933:10933
  #   environment:
  #     ACCEPT_EULA: ${ACCEPT_EULA}
  #     ServerUrl: ${OCTOPUS_SERVER_URL}
  #     ServerApiKey: ${OCTOPUS_SERVER_API_KEY}
  #     ServerUsername: ${OCTOPUS_ADMIN_USERNAME}
  #     ServerPassword: ${OCTOPUS_ADMIN_PASSWORD}
  #     TargetEnvironment: ${OCTOPUS_ENVIRONMENT}
  #     TargetRole: ${OCTOPUS_ACTIVE_TENTACLE_ROLE}
  #     ListeningPort: ${OCTOPUS_ACTIVE_TENTACLE_PORT}
  #   volumes:
  #     - "/octopus/listening_tentacle:/applications"
  #   restart: unless-stopped
    
  octo_polling_tentacle:
    image: octopusdeploy/tentacle:${OCTOPUS_TENTACLE_TAG}
    container_name: octo_polling_tentacle
    environment:
      ACCEPT_EULA: ${ACCEPT_EULA}
      ServerUrl: ${OCTOPUS_SERVER_URL}
      ServerApiKey: ${OCTOPUS_SERVER_API_KEY}
      ServerUsername: ${OCTOPUS_ADMIN_USERNAME}
      ServerPassword: ${OCTOPUS_ADMIN_PASSWORD}
      TargetEnvironment: ${OCTOPUS_ENVIRONMENT}
      TargetRole: ${OCTOPUS_PASSIVE_TENTACLE_ROLE}
      ServerPort: ${OCTOPUS_PASSIVE_TENTACLE_PORT}
    volumes:
      - "/octopus/polling_tentacle:/applications"
    restart: unless-stopped

.env文件的触手

ACCEPT_EULA=Y

OCTOPUS_TENTACLE_TAG=latest  

OCTOPUS_ADMIN_USERNAME=admin
OCTOPUS_ADMIN_PASSWORD=p@$$0Rd;-

OCTOPUS_SERVER_API_KEY=API-OR9CLUYBPYQW5UV6WQXSXNVZHSA
OCTOPUS_SERVER_URL=http://localhost:81

OCTOPUS_ACTIVE_TENTACLE_ROLE=app-server
OCTOPUS_ACTIVE_TENTACLE_PORT=10933

OCTOPUS_ENVIRONMENT=Development  

OCTOPUS_PASSIVE_TENTACLE_ROLE=web-server
OCTOPUS_PASSIVE_TENTACLE_PORT=10943

服务程序启动后,我将创建一个API_KEY并将其分配给=> OCTOPUS_SERVER_API_KEY = API-OR9CLUYBPYQW5UV6WQXSXNVZHSA

启动触手时,服务器对此做出响应

octo_server | listen://[::]:10943/              9  Accepted TCP client: [::ffff:172.27.0.1]:33496
octo_server | listen://[::]:10943/              9  Accepted TCP client: [::ffff:172.27.0.1]:33500
octo_server | listen://[::]:10943/             26  Unhandled error when handling request from client: [::ffff:172.27.0.1]:33496
octo_server | System.IO.IOException: The handshake Failed due to an unexpected packet format.
octo_server |    at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer,Int32 readBytes,AsyncProtocolRequest asyncRequest)
octo_server |    at System.Net.Security.SslStream.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
octo_server | --- End of stack trace from prevIoUs location where exception was thrown ---
octo_server |    at System.Net.Security.SslStream.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
octo_server |    at System.Net.Security.SslStream.EndProcessAuthentication(IAsyncResult result)
octo_server |    at System.Net.Security.SslStream.EndAuthenticateAsServer(IAsyncResult asyncResult)
octo_server |    at System.Net.Security.SslStream.<>c.<AuthenticateAsServerAsync>b__68_2(IAsyncResult iar)
octo_server |    at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar,Func`2 endFunction,Action`1 endAction,Task`1 promise,Boolean requiresSynchronization)
octo_server | --- End of stack trace from prevIoUs location where exception was thrown ---
octo_server |    at Halibut.Transport.SecureListener.ExecuteRequest(TcpClient client)
octo_server | listen://[::]:10943/             26  Unhandled error when handling request from client: [::ffff:172.27.0.1]:33500
octo_server | System.IO.IOException: The handshake Failed due to an unexpected packet format.
octo_server |    at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer,Boolean requiresSynchronization)
octo_server | --- End of stack trace from prevIoUs location where exception was thrown ---
octo_server |    at Halibut.Transport.SecureListener.ExecuteRequest(TcpClient client)
octo_server | listen://[::]:10943/              9  Accepted TCP client: [::ffff:172.27.0.1]:33506
octo_server | listen://[::]:10943/              9  Unhandled error when handling request from client: [::ffff:172.27.0.1]:33506
octo_server | System.IO.IOException: The handshake Failed due to an unexpected packet format.
octo_server |    at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer,AsyncProtocolRequest asyncRequest)
octo_server |    at System.Net.Security.SslStream.StartReceiveBlob(Byte[] buffer,AsyncProtocolRequest asyncRequest)
octo_server |    at System.Net.Security.SslStream.ForceAuthentication(Boolean receiveFirst,Byte[] buffer,AsyncProtocolRequest asyncRequest)
octo_server |    at System.Net.Security.SslStream.ProcessAuthentication(LazyAsyncResult lazyResult,CancellationToken cancellationToken)
octo_server |    at System.Net.Security.SslStream.BeginAuthenticateAsServer(SslServerAuthenticationoptions sslServerAuthenticationoptions,CancellationToken cancellationToken,AsyncCallback asyncCallback,Object asyncState)
octo_server |    at System.Net.Security.SslStream.BeginAuthenticateAsServer(X509Certificate serverCertificate,Boolean clientCertificaterequired,SslProtocols enabledSslProtocols,Boolean checkCertificateRevocation,Object asyncState)
octo_server |    at System.Net.Security.SslStream.<>c.<AuthenticateAsServerAsync>b__68_1(X509Certificate arg1,Boolean arg2,SslProtocols arg3,AsyncCallback callback,Object state)
octo_server |    at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2,TArg3](Func`6 beginMethod,TArg1 arg1,TArg2 arg2,TArg3 arg3,Object state,TaskCreationoptions creationoptions)
octo_server |    at System.Threading.Tasks.TaskFactory.FromAsync[TArg1,Action`1 endMethod,Object state)
octo_server |    at System.Net.Security.SslStream.AuthenticateAsServerAsync(X509Certificate serverCertificate,Boolean checkCertificateRevocation)
octo_server |    at Halibut.Transport.SecureListener.ExecuteRequest(TcpClient client)

还有触手,这很有意义,因为服务器拒绝连接

octo_polling_tentacle    | + [[ Y != \Y ]]
octo_polling_tentacle    | + '[' -f /usr/bin/tentacle ']'
octo_polling_tentacle    | + ln -s /opt/octopus/tentacle/Tentacle /usr/bin/tentacle
octo_polling_tentacle    | + instanceName=Tentacle
octo_polling_tentacle    | + configurationDirectory=/etc/octopus
octo_polling_tentacle    | + applicationsDirectory=/home/Octopus/Applications
octo_polling_tentacle    | + mkdir -p /etc/octopus
octo_polling_tentacle    | + mkdir -p /home/Octopus/Applications
octo_polling_tentacle    | + tentacle create-instance --instance Tentacle --config /etc/octopus/tentacle.config
octo_polling_tentacle    | Creating empty configuration file: /etc/octopus/tentacle.config
octo_polling_tentacle    | Saving instance: Tentacle
octo_polling_tentacle    | Setting home directory to: /etc/octopus
octo_polling_tentacle    | + tentacle new-certificate --instance Tentacle --if-blank
octo_polling_tentacle    | A new certificate has been generated and installed. Thumbprint:
octo_polling_tentacle    | B179B05658E168F7535BC2F17E1F8AC43B9DE044
octo_polling_tentacle    | These changes require a restart of the Tentacle.
octo_polling_tentacle    | + tentacle configure --instance Tentacle --app /home/Octopus/Applications --noListen True --reset-trust
octo_polling_tentacle    | Removing all trusted Octopus Servers...
octo_polling_tentacle    | Application directory set to: /home/Octopus/Applications
octo_polling_tentacle    | Tentacle will not listen on a port
octo_polling_tentacle    | These changes require a restart of the Tentacle.
octo_polling_tentacle    | + tentacle register-worker --instance Tentacle --server http://localhost:81 --name 6fbee425d1b9 --comms-style TentacleActive --server-comms-port 10943 --apiKey API-OR9CLUYBPYQW5UV6WQXSXNVZHSA --space Default '--workerpool=Default Worker Pool' '--policy=Default Machine Policy' --force
octo_polling_tentacle    | Checking connectivity on the server communications port 10943...
octo_polling_tentacle    | {0} Failed with message {1). retrying ({2}/{3}) in {4}. (Checking that server communications are open,Cannot assign requested address Cannot assign requested address,1,00:00:00.7500000) => Input string was not in a correct format.
octo_polling_tentacle    | System.Net.WebException: Cannot assign requested address Cannot assign requested address
octo_polling_tentacle    |  ---> System.Net.Http.HttpRequestException: Cannot assign requested address
octo_polling_tentacle    |  ---> System.Net.sockets.socketException (99): Cannot assign requested address
octo_polling_tentacle    |    at System.Net.Http.ConnectHelper.ConnectAsync(String host,CancellationToken cancellationToken)
octo_polling_tentacle    |    --- End of inner exception stack trace ---
octo_polling_tentacle    |    at System.Net.Http.ConnectHelper.ConnectAsync(String host,CancellationToken cancellationToken)
octo_polling_tentacle    |    at System.Net.Http.httpconnectionPool.ConnectAsync(HttpRequestMessage request,CancellationToken cancellationToken)
octo_polling_tentacle    |    at System.Net.Http.httpconnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request,CancellationToken cancellationToken)
octo_polling_tentacle    |    at System.Net.Http.httpconnectionPool.GethttpconnectionAsync(HttpRequestMessage request,CancellationToken cancellationToken)
octo_polling_tentacle    |    at System.Net.Http.httpconnectionPool.SendWithRetryAsync(HttpRequestMessage request,CancellationToken cancellationToken)
octo_polling_tentacle    |    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
octo_polling_tentacle    |    at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask,Boolean disposeCts)
octo_polling_tentacle    |    at System.Net.HttpWebRequest.SendRequest()
octo_polling_tentacle    |    at System.Net.HttpWebRequest.GetResponse()
octo_polling_tentacle    |    --- End of inner exception stack trace ---
octo_polling_tentacle    |    at System.Net.HttpWebRequest.GetResponse()
octo_polling_tentacle    |    at Octopus.Tentacle.Communications.OctopusServerChecker.<>c__displayClass2_0.<CheckServerCommunicationsIsOpen>b__1() in /opt/TeamCity/BuildAgent/work/e5cfddd118f4e691/source/Octopus.Tentacle/Communications/OctopusServerChecker.cs:line 48
octo_polling_tentacle    |    at Octopus.Tentacle.Communications.OctopusServerChecker.Retry(String actionDescription,Action action,Int32 retryCount,TimeSpan initialDelay,Double backOffFactor) in /opt/TeamCity/BuildAgent/work/e5cfddd118f4e691/source/Octopus.Tentacle/Communications/OctopusServerChecker.cs:line 85

我猜测与网络有关,但不确定。

问题是什么,要解决这个问题吗?

解决方法

我的解决方法如下

version: "3.8"

networks:
  octo_net:
    ipam:
      driver: default
      config:
        - subnet: 172.28.0.0/26

services:
  db:
    image: microsoft/mssql-server-windows-express:latest
    container_name: octo-sql
    environment:
      ACCEPT_EULA: ${ACCEPT_EULA}
      SA_PASSWORD: ${SQL_SA_PASSWORD}
    networks:
      octo_net:
        ipv4_address: 172.28.0.11
    restart: unless-stopped

  server:
    image: octopusdeploy/octopusdeploy:${OCTOPUS_SERVER_TAG}
    container_name: octo-server
    depends_on:
      - db
    environment:
      ACCEPT_EULA:                   ${ACCEPT_EULA}
      ACCEPT_OCTOPUS_EULA:           ${ACCEPT_EULA}
      ADMIN_USERNAME:                ${OCTOPUS_ADMIN_USERNAME}
      ADMIN_PASSWORD:                ${OCTOPUS_ADMIN_PASSWORD}
      ADMIN_EMAIL:                   ${OCTOPUS_ADMIN_EMAIL}
      DB_CONNECTION_STRING:          ${SQL_CONNECTION}
      OCTOPUS_SERVER_NODE_NAME:      ${OCTOPUS_SERVER_NODE_NAME}
      OCTOPUS_SERVER_BASE64_LICENSE: ${OCTOPUS_SERVER_BASE64_LICENSE}
    networks:
      octo_net:
        ipv4_address: 172.28.0.12
    restart: unless-stopped

  octo_listenting_tentacle1:
    image: octopusdeploy/tentacle:${OCTOPUS_TENTACLE_TAG}
    container_name: octo-listenting-tentacle-dev-1
    depends_on:
      - server
    environment:
      ACCEPT_EULA:       ${ACCEPT_EULA}
      ServerUrl:         ${OCTOPUS_SERVER_URL}
      ServerUsername:    ${OCTOPUS_ADMIN_USERNAME}
      ServerPassword:    ${OCTOPUS_ADMIN_PASSWORD}
      ListeningPort:     ${OCTOPUS_ACTIVE_TENTACLE_PORT}
      TargetEnvironment: ${ENVIRONMENT_DEV}
      TargetRole:        ${OCTOPUS_ACTIVE_TENTACLE_ROLE}
    networks:
      octo_net:
        ipv4_address: 172.28.0.14
    restart: unless-stopped
  
  octo_listenting_tentacle2:
    image: octopusdeploy/tentacle:${OCTOPUS_TENTACLE_TAG}
    container_name: octo-listenting-tentacle-dev-2
    depends_on:
      - server
    environment:
      ACCEPT_EULA:       ${ACCEPT_EULA}
      ServerUrl:         ${OCTOPUS_SERVER_URL}
      ServerUsername:    ${OCTOPUS_ADMIN_USERNAME}
      ServerPassword:    ${OCTOPUS_ADMIN_PASSWORD}
      ListeningPort:     ${OCTOPUS_ACTIVE_TENTACLE_PORT}
      TargetEnvironment: ${ENVIRONMENT_DEV}
      TargetRole:        ${OCTOPUS_ACTIVE_TENTACLE_ROLE}
    networks:
      octo_net:
        ipv4_address: 172.28.0.15
    restart: unless-stopped
    
  octo_listenting_tentacle3:
    image: octopusdeploy/tentacle:${OCTOPUS_TENTACLE_TAG}
    container_name: octo-listenting-tentacle-prd
    depends_on:
      - server
    environment:
      ACCEPT_EULA:       ${ACCEPT_EULA}
      ServerUrl:         ${OCTOPUS_SERVER_URL}
      ServerUsername:    ${OCTOPUS_ADMIN_USERNAME}
      ServerPassword:    ${OCTOPUS_ADMIN_PASSWORD}
      ListeningPort:     ${OCTOPUS_ACTIVE_TENTACLE_PORT}
      TargetEnvironment: ${ENVIRONMENT_PRD}
      TargetRole:        ${OCTOPUS_ACTIVE_TENTACLE_ROLE}
    networks:
      octo_net:
        ipv4_address: 172.28.0.16
    restart: unless-stopped
    

.env文件

ACCEPT_EULA=Y

SQL_SERVER_TAG=2017-latest
SQL_SA_PASSWORD=Your_password123    
SQL_CONNECTION=Server=172.28.0.11,1433;Initial Catalog=Octopus;Persist Security Info=False;User ID=sa;Password=Your_password123;MultipleActiveResultSets=False;Connection Timeout=30; 

ENVIRONMENT_DEV=Dev 
ENVIRONMENT_PRD=Release    

OCTOPUS_SERVER_TAG=latest

OCTOPUS_ADMIN_USERNAME=admin
OCTOPUS_ADMIN_PASSWORD=p@$$0Rd;-

OCTOPUS_SERVER_NODE_NAME=octo_server

OCTOPUS_ADMIN_EMAIL=
OCTOPUS_SERVER_BASE64_LICENSE=

OCTOPUS_TENTACLE_TAG=latest  

OCTOPUS_SERVER_URL=http://172.28.0.12:8080

OCTOPUS_ACTIVE_TENTACLE_ROLE=app-server
OCTOPUS_ACTIVE_TENTACLE_PORT=10933  

OCTOPUS_PASSIVE_TENTACLE_ROLE=web-server
OCTOPUS_PASSIVE_TENTACLE_PORT=10943

区别在于,与其将容器端口绑定到本地主机端口,而不是让docker配置网络,我必须自己配置网络,使用分配的IP将容器彼此连接。

但是,运行该应用程序并不容易,因为触手需要一个只能从octopus服务器设置的环境。实际上,以下是我必须采取的步骤。

  1. 评论octo_listener_tentacle服务
  2. 运行docker-compose命令并等待应用程序完成启动
  3. 去章鱼并创建环境
  4. 停止运行的应用程序(CTR + C),但不要删除它
  5. 取消对octo_listener_tentacle服务的注释
  6. 再次docker-compose up,它将重新启动已停止的容器,并创建和启动新容器。

就这样。

如果有一个环境变量可以设置并指定一个逗号分隔的字符串,章鱼服务器将使用该变量来初始化您的环境,那就太好了。

这也是基于Windows的容器设置,将仅在Windows容器上运行。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...