0

I am using docker for windows and have a docker compose file that is creating a couple of customer applications as well as a RabbitMq and a Seq container. These are all talking to each other via instance names on the local network created by docker-compose, for example;

version: '3.4'

services:
  legacydata.workerservice:
    container_name: legacydata.workerservice
    image: ${DOCKER_REGISTRY-}legacydataworkerservice
    build:
      context: .
      dockerfile: LegacyData.Worker/Dockerfile
    depends_on:
      - rabbitmq

  legacydata.consumer:
    container_name: legacydata.consumer
    image: ${DOCKER_REGISTRY-}legacydataconsumer
    build:
      context: .
      dockerfile: LegacyData.Consumer/Dockerfile
    depends_on:
      - rabbitmq

  rabbitmq:
    image: rabbitmq:3-management-alpine
    container_name: rabbitmq
    environment:
      - RABBITMQ_ERLANG_COOKIE='secretcookie'
      - RABBITMQ_DEFAULT_USER=user
      - RABBITMQ_DEFAULT_PASS=password        
    ports:
      - 5672:5672
      - 15672:15672

## Move Seq to Azure ACI
#  seq:
#    image: datalust/seq:latest
#    container_name: seq
#    ports:
#      - 5341:80
#    environment:
#      ACCEPT_EULA: Y

I want move the Seq instance into Azure ACI (I have this running and I can access it as expected for example http://myseq.southuk.azurecontainer.io).

How do I configure the docker to allow my local containers to access both each other, and internet resources?

Mark Cooper
  • 6,738
  • 5
  • 54
  • 92
  • You don't need to do anything special; this should just work. Can you describe a more specific problem you're having, with an actual host name, error message, and [mcve]? – David Maze Sep 16 '20 at 14:37
  • Do you mean allow communication between both `legacydata.consumer` and `legacydata.workerservice`? – Assael Azran Sep 16 '20 at 14:38
  • @AssaelAzran no - each of the legacy database services should talk to RabbitMq (locally running container in Docker for desktop) and Seq (Azure ACI running container) – Mark Cooper Sep 16 '20 at 14:58
  • @DavidMaze this was the minimum reproducible environment for me.... but I'm behind a corporate proxy. If this should *just work* then it might be the proxy is effecting things... wouldn't be the first time [face-palm]... – Mark Cooper Sep 16 '20 at 15:01
  • Have you tried to define your services to use a user-defined network ? – Assael Azran Sep 16 '20 at 15:02
  • I would agree with @DavidMaze, by default it should work. – Carlos Sep 16 '20 at 17:09
  • @AssaelAzran no I have not (intentionally) defined any networks. – Mark Cooper Sep 17 '20 at 10:05
  • @DavidMaze should my local docker containers use the proxy that is configured within the docker desktop settings? If this is set, will it then prevent the local connections from working as that proxy won't recognise the container group URLs? – Mark Cooper Sep 17 '20 at 10:08

1 Answers1

0

Actually, you can create a container group contains all the containers, the containers inside a container group can communicate with each other with the ports that they have exposed. You follow the example here. And in default, the containers also can access the Internet with no problem.

The only problem is that you need to create all the images yourself locally from the Dockerfile. ACI does not support to create the images for you.

Charles Xu
  • 29,862
  • 2
  • 22
  • 39
  • Thanks for taking the time to respond. Azure ACI might be irrelevant. I don't think my local docker containers can access any remote URLs. – Mark Cooper Sep 17 '20 at 10:06
  • @MarkCooper You containers just need to communicate with each other, do not need to access remote URLs. Who said it the container need to access remote URLs? – Charles Xu Sep 21 '20 at 01:39
  • I need to access remote Urls, for example; an online Seq server, Application Insights or an Azure Message Queue. – Mark Cooper Sep 21 '20 at 07:47
  • @MarkCooper Just do it. Containers inside the group can access outside. Only when the outside access the containers inside the group need the port exposed. – Charles Xu Sep 21 '20 at 07:50
  • @MarkCooper Any updates for the question? Does it solve your problem? – Charles Xu Sep 22 '20 at 08:06
  • Sorry, it didn't solve my issue. I must have something else configured somewhere, or a problem with the corporate network. – Mark Cooper Sep 22 '20 at 14:58
  • @MarkCooper So what is the problem now? – Charles Xu Sep 23 '20 at 01:40
  • Still the same - the connections between the containers locally and in the cloud aren't working. I've gone right back to basics on the setup and kept the container simple so if "this should just work" then its sensible to assume that my problems are related to a network issue (perhaps corporate proxy or firewall that is blocking the traffic) which puts this beyond anything I can investigate or influence. – Mark Cooper Sep 23 '20 at 09:27
  • @MarkCooper In the container groups, what is the way you use for containers to communicate with each other? – Charles Xu Sep 23 '20 at 09:39
  • Within the containers the apps are talking to each other OK. I am not able to get the local containers talking to remote containers. Like you said this should just work so I'm convinced this is a problem caused by the overly restrictive corporate network. – Mark Cooper Sep 24 '20 at 09:59
  • @MarkCooper Do you check if the ACI works well and can be accessible on another side? The ACI does not support port mapping. So jus exposes the port directly without mapping. – Charles Xu Sep 25 '20 at 07:00