0

Disclaimer: I am novice docker user.

I was provided with docker yaml file that sets up multiple pods. these pods provide the backend for the web app I am working on. I want to simulate network interruption for one, few and all of these pods.

5dcc51f2837a        broker-one                     "sh -c 'sleep 5 && n…"   24 hours ago        Up 3 hours          0.0.0.0:8002->3000/tcp   broker-compose_broker-one_1
5a1e97531c1f        broker-two                      "sh -c 'sleep 5 && n…"   24 hours ago        Up 3 hours          0.0.0.0:8003->3000/tcp   broker-compose_broker-two_1
4c3a539f28c2        broker-three                   "sh -c 'sleep 5 && n…"   24 hours ago        Up 3 hours          0.0.0.0:8006->3000/tcp   broker-compose_broker-three_1
3809f0b2a24f        broker-four                    "sh -c 'sleep 5 && n…"   24 hours ago        Up 3 hours          0.0.0.0:8004->3000/tcp   broker-compose_broker-four_1
658a60f02e94        broker-five                      "npm run dev"            24 hours ago        Up 3 hours          0.0.0.0:8000->3000/tcp   broker-compose_broker-five_1

is this possible at all?

David Maze
  • 130,717
  • 29
  • 175
  • 215
InsaneBot
  • 2,422
  • 2
  • 19
  • 31
  • This isn't Docker's strong suit. It's probably _possible_, with manual `iptables` commands, but designing that is out of scope for an SO question. – David Maze Jan 04 '19 at 18:48
  • I feel like your comment should be turned into an answer, It still has lots of value to me. can you point me toward an example of what you proposing with `iptables` ? – InsaneBot Jan 04 '19 at 19:18

1 Answers1

1

Docker doesn't have a built-in way to do this. In general, it's not a great tool for doing network simulations, since it doesn't give a lot of direct control over its networking stack.

If you're very comfortable with the Linux iptables stack then manually configuring firewall rules on the interfaces that get automatically created is a little more socially acceptable than tweaking many the other things Docker does on its own. Simulate delayed and dropped packets on Linux might be a reasonable starting point.

David Maze
  • 130,717
  • 29
  • 175
  • 215