# How to define task dependency with Docker container mode networking?

**URL:** <https://discuss.hashicorp.com/t/how-to-define-task-dependency-with-docker-container-mode-networking/21933>\
**Category:** Nomad\
**Tags:** task-dependencies\
**Created:** [March 11, 2021, 12:25pm UTC](https://discuss.hashicorp.com/t/how-to-define-task-dependency-with-docker-container-mode-networking/21933 "2021-03-11T12:25:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![0xbkt](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/0xbkt/32/3374_2.png) [@0xbkt](https://discuss.hashicorp.com/u/0xbkt)\
**Post date:** [March 11, 2021, 12:25pm UTC](https://discuss.hashicorp.com/t/how-to-define-task-dependency-with-docker-container-mode-networking/21933/1 "2021-03-11T12:25:18Z")

</div>

Hello.

With 2 tasks (one sidecar: `wireguard`, one app container: `http-server`) in the same group, how can I define that the app container should share the same network interfaces with its sidecar? I normally use `--network=container:wireguard` with Docker, but with Nomad I’m not sure how to make the sidecar a dependency and get its container name to be used with the actual task’s config.

---

<div class="post-metadata">

**Author:** ![lgfa29](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/lgfa29/32/2386_2.png) [@lgfa29](https://discuss.hashicorp.com/u/lgfa29)\
**Post date:** [March 12, 2021, 2:06am UTC](https://discuss.hashicorp.com/t/how-to-define-task-dependency-with-docker-container-mode-networking/21933/2 "2021-03-12T02:06:08Z")

</div>

Hi @0xbkt,

Since the two tasks are in the same `group` they will automatically share the same network namespace.

Is this not happening for you? Could you share a sample job file?

Thanks!
