Containers networking issue


#1

Hey!.
My team is getting started with circleci 2.0, it was very fast especially when using the docker executor, we are running about 30 container, our pipeline becomes very fast(building, running tests…).

but we are getting some issues concerning networking, for example some tests requires Rabbitmq in order to be executed.

in tests we are passing rabbitmq url (http://mq:5672) but we cannot query the services.
we are using docker-compose for that.

    dispatcher(service, event, payload)
/usr/local/lib/python2.7/site-packages/nameko/standalone/events.py:43: in dispatch
    exchange.maybe_bind(connection)  # TODO: reqd? maybe_declare?
/usr/local/lib/python2.7/site-packages/kombu/abstract.py:78: in maybe_bind
    self._channel = maybe_channel(channel)
/usr/local/lib/python2.7/site-packages/kombu/connection.py:1069: in maybe_channel
    return channel.default_channel
/usr/local/lib/python2.7/site-packages/kombu/connection.py:771: in default_channel
    self.connection
/usr/local/lib/python2.7/site-packages/kombu/connection.py:756: in connection
    self._connection = self._establish_connection()
/usr/local/lib/python2.7/site-packages/kombu/connection.py:711: in _establish_connection
    conn = self.transport.establish_connection()
/usr/local/lib/python2.7/site-packages/kombu/transport/pyamqp.py:116: in establish_connection
    conn = self.Connection(**opts)
/usr/local/lib/python2.7/site-packages/amqp/connection.py:165: in __init__
    self.transport = self.Transport(host, connect_timeout, ssl)
/usr/local/lib/python2.7/site-packages/amqp/connection.py:186: in Transport
    return create_transport(host, connect_timeout, ssl)
/usr/local/lib/python2.7/site-packages/amqp/transport.py:299: in create_transport
    return TCPTransport(host, connect_timeout)
/usr/local/lib/python2.7/site-packages/amqp/transport.py:75: in __init__
    socket.SOCK_STREAM, SOL_TCP):

Our docker-compose structure

app:
    build: .
    depends_on:
      - mq
    environment:
      - BROKER_URL=pyamqp://guest:guest@mq:5672/
    volumes:
      - ./tests:/opt/tests
    networks:
      - private-network
    command: pytest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
mq:
    image: rabbitmq:3-management
    ports:
      # go to http://localhost:15672 (guest:guest) to view rabbitmq admin console
      - 15672:15672
    networks:
      - private-network
      - public-network #public for accessing rabbitmq-ui
networks:
  private-network:
    driver: bridge
  public-network:
    driver: bridge

The strange behaviour is that it works for some containers but not for others.

Any suggestions please.


#2

You can’t connect directly to the containers you bring up while on the docker executor. You can on the machine, though.

On the docker executor, you should just list that RabbitMQ container as a service to run alongside the base container.


#3

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.