2

I am looking for a solution to how to run tc qdisc command in Docker Ubuntu.

The version of Ubuntu is 20.04 LTS and I run Docker on Windows. Here's part of my docker-compose.yml:

fuseki_1:
        image: leroykim/jena-fuseki:ubuntu
        container_name: fuseki_1
        depends_on: 
            - fuseki-data_1
        ports:
            - "3031:3030"
        cap_add:
            - NET_ADMIN
        command: bash -c "apt-get update && apt-get -y install iproute2"
fuseki_2:
        image: leroykim/jena-fuseki:ubuntu
        container_name: fuseki_2
        depends_on: 
            - fuseki-data_2
        ports: 
            - "3032:3030"
fuseki_3:
        image: leroykim/jena-fuseki:ubuntu
        container_name: fuseki_3
        depends_on: 
            - fuseki-data_3
        ports: 
            - "3033:3030"

By this setting, I want to introduce some delays, duplicates, and losses to fuseki_1 and simulate the real-world-like network during federated queries.

The commands I want to run are like this:

sudo tc qdisc add dev eth0 root handle 1: prio
sudo tc qdisc add dev eth0 parent 1:1 handle 2: netem delay 100ms 5ms 25% loss 15.3% 25% duplicate 1% corrupt 0.1% reorder 5% 50%

The problem is that the commands keep throwing the Error: Specified qdisc not found. error.

I checked the several stack overflow answers and web pages. It seems they run the tc qdisc commands smoothly, but none of them worked for me:

I really appreciate your help in advance!

leroykim
  • 85
  • 1
  • 6

1 Answers1

2

I figured it out.

The Windows WSL 2 backend was the problem. I turned off the Settings > General > Use the WSL 2 based engine option and those commands finally worked.

For clarity, these settings are found in your Docker instance. enter image description here

Uncle Iroh
  • 5,748
  • 6
  • 48
  • 61
leroykim
  • 85
  • 1
  • 6
  • This isn't possible on Windows 10, its telling me that this option is required and I cannot use Docker when WSL 2 is disabled. – Navigatron Sep 27 '22 at 21:26
  • You also might need to install Hyper-V on Windows 10 (https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v) – Andy R Jul 03 '23 at 09:29