docker-networking

docker swarm: A stack just for shared networks

独自空忆成欢 提交于 2019-12-11 04:38:06
问题 I have many docker compose files which describe multiple stacks (Application, Monitoring infra, Logging Infra, Some other application). Some of these stacks need to share a network. Since the dependencies between the stacks (X needs Y to start fist, Y needs Z) are becoming more and more complicated I wanted to introduce one stack that contains all the networks that will be shared so that I can then deploy all stacks in any order. version: "3.1" networks: iotivity: proxy: Unfortunately a

How to expose a service running inside a docker container, bound to localhost

吃可爱长大的小学妹 提交于 2019-12-11 04:29:05
问题 I have a service running inside a docker-container, which by default only binds to localhost. I could reconfigure / reprogram this service to bind to all interfaces, but this might have security implications in other contexts. Is there any way to expose a service bound to localhost inside a docker container? 回答1: I ended up using socat inside the docker container, to proxy any tcp connections on the relevant port-number coming in on the public interface, to the private interface. For example,

Can't resolve hostnames between docker containers

人走茶凉 提交于 2019-12-10 19:44:11
问题 I have two containers created in separate compose files (done for application isolation -- each application may have multiple containers defined in the compose file such as a backing database). These containers are linked via an external network named "common". An example compose file would be: version: '2' services: rabbitmq: image: "rabbitmq:3-management" hostname: "rabbitmq" container_name: "rabbitmq" environment: RABBITMQ_ERLANG_COOKIE: "SWQOKODSQALRPCLNMEQG" RABBITMQ_DEFAULT_USER:

Docker: cannot open port from container to host

南笙酒味 提交于 2019-12-10 14:30:01
问题 I'm using Docker for Mac . I have a container that run a server, for example my server is run on port 5000. I have exposed this port on Dockerfile When my container is running, I connect to this container and check and if this server is working or not by running below command and see that it returns data (a bunch of html and javascript) wget -d localhost:5000 Notes, I start this container and also publish port outside by command: docker run -d -p 5000:5000 <docker_image_name> But at docker

How can I make a communication between several docker containers on my local network

冷暖自知 提交于 2019-12-10 11:58:17
问题 I'm currently working on hyperledger blockchain that use several docker containers : dev-peer0.org1.example.com-marbles-v5.9 peer0.org1.example.com couchdb orderer.example.com cli ca.example.com On the default configuration they are all running on the same machine. What I'm trying to achieve is to divide them on two different computers : Computer 1 : dev-peer0.org1.example.com-marbles-v5.9 peer0.org1.example.com couchdb Computer 2 : orderer.example.com cli ca.example.com Can I use the host

Enable broadcasts between docker containers

独自空忆成欢 提交于 2019-12-10 10:24:53
问题 I've been trying to enable some UDP discovery between a few containers. It tuned out that containers have disabled broadcasts by default, missing brd for inet in: $ ip addr show dev eth0 27: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP link/ether 00:00:01:4f:6a:47 brd ff:ff:ff:ff:ff:ff inet 172.17.0.12/16 scope global eth0 valid_lft forever preferred_lft forever Stack: host: ubuntu 14.04 container: ubuntu 12.04 docker 1.8.3 How do I enable the broadcasts? Here's

Docker swarm with a custom network

耗尽温柔 提交于 2019-12-09 16:53:13
问题 I'm trying to work out how to properly use swarm mode in Docker. First I tried running containers on my 2 workers and manager machine without specifying a custom network (so I'm using the default ingress overlay network). However, If I use the ingress network, for some reason I cannot resolve tasks.myservice . So I tried configuring a custom network like this: docker network create -d overlay elasticnet So now, when I bash into one of the containers, I can successfully resolve tasks.myservice

Enable broadcasts between docker containers

给你一囗甜甜゛ 提交于 2019-12-06 00:08:35
I've been trying to enable some UDP discovery between a few containers. It tuned out that containers have disabled broadcasts by default, missing brd for inet in: $ ip addr show dev eth0 27: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP link/ether 00:00:01:4f:6a:47 brd ff:ff:ff:ff:ff:ff inet 172.17.0.12/16 scope global eth0 valid_lft forever preferred_lft forever Stack: host: ubuntu 14.04 container: ubuntu 12.04 docker 1.8.3 How do I enable the broadcasts? Here's what I've tried so far: ip link set dev eth0 broadcast 172.17.255.255 gives RTNETLINK answers: Invalid

Docker service discovery does not work with default bridge

落花浮王杯 提交于 2019-12-05 21:14:05
Seems like docker service discovery just works with user defined networks and not with default bridge (docker0) , but I didn't find anything in the docs. docker run --rm -d --name c1 alpine sleep 2h docker run --rm -d --name c2 alpine sleep 2h docker exec -ti c1 ping c2 It gives me ping: bad address 'c2' But if I create a custom bridge network everthing works fine: docker network create u-bridge docker run --rm -d --name u1 --net u-bridge alpine sleep 2h docker run --rm -d --name u2 --net u-bridge alpine sleep 2h docker exec -ti u1 ping u2 It gives me: PING u2 (172.18.0.3): 56 data bytes (...)

Docker linked containers, Docker Networks, Compose Networks - how should we now 'link' containers

落爺英雄遲暮 提交于 2019-12-05 06:01:46
I have an existing app that comprises of 4 docker containers running on the same host. They have been linked together using the link command. However, after some upgrades of docker, the link behaviour has been deprecated, and changed it seems. We are having issues where containers are loosing the link to each other now. So, docker says to use the new Network feature over link ed containers. But I can't see how this works. If 2 containers are in the same network, are the same ENV vars automatically exposed on the containers as if they were linked? Or is the hosts file updated with the correct