在Mac OS上连接docker-compose容器

时间:2019-03-01 19:15:08

标签: macos docker docker-compose

在Mac OS上运行docker-compose(1.23.2,build 1110ad01),我很难获取容器的IP地址。我的撰写文件如下所示:

Public Sub MakeSelections()
Dim IE As New InternetExplorer
With IE
    .Visible = True
    .Navigate2 "https://register.fca.org.uk/ShPo_FirmDetailsPage?id=001b000000MfF1EAAV"

    While .Busy Or .readyState < 4: DoEvents: Wend

    .document.querySelector("[href*=FirmIndiv]").Click '<==click the + for indiv
    .document.querySelector("#IndividualSearchResults_length[value='500']").Selected = True
End With

Dim nTable As HTMLTable

Do: On Error Resume Next: Set nTable =IE.document.getElementById("IndividualSearchResults"): On Error GoTo 0: DoEvents: Loop While nTable Is Nothing

Dim nRow As Object, nCell As Object, r As Long, c As Long

With ActiveSheet
    Dim nBody As Object
    Set nBody = nTable.getElementsByTagName("Name")(0) _
                      .getElementsByTagName("ShG1_IRN_c") _
                      .getElementsByTagName("ShGl_IndividualStatus__c") _
                      .getElementsByTagName("ShPo_Registerstatus__c") _
                      .getElementsByTagName("Id") _
                      .getElementsByTagName("RecordTypeId") _
                      .getElementsByTagName("CurrencyIsoCode") _
    .Cells(1, 1) = nBody(0).innerText
    For r = 2 To nBody.Length - 1
        Set nRow = nBody(r)
        For Each nCell In nRow.Cells
            c = c + 1: .Cells(r + 1, c) = nCell.innerText
        Next nCell
        c = 0
    Next r
End With

End Sub

我可以看到两个容器都还活着,并且可以看到端口54000上正在监听

version: '3.4'

services:
  secondcontainer:
    image: myregistry/secondcontainer
    networks: mynet
    deploy:
      replicas: 1
      resources:
        limits:
          cpus: "1.0"
          memory: 500M
      restart_policy:
        condition: on-failure
    ports:
      - "54000:54000"
    networks:
      - mynet
networks:
  mynet:

我正在尝试使用Mac上运行的C#应用​​程序访问此容器。无论我使用什么IP地址,我似乎都无法接通。我尝试了127.0.0.1:54000,我尝试了Mac主机的本地IP,我尝试了使用正确的端口为容器分配的IP地址(例如172.25.0.3)。我已经尝试过使用nc,那里没有运气。

相同的代码在Linux上可以完美运行。我知道Mac上的Docker可能存在问题,但这不是受支持的情况吗?

0 个答案:

没有答案