<commit_before>---
description: Networking
keywords: mac, networking
redirect_from:
- /docker-for-mac/networking/
- /mackit/networking/
title: Networking features in Docker Desktop for Mac
---
{% assign Arch = 'Mac' %}

Docker Desktop for {{Arch}} provides several networking features to make it
easier to use.

## Features

### VPN Passthrough

Docker Desktop for {{Arch}}'s networking can work when attached to a VPN. To do this,
Docker Desktop for {{Arch}} intercepts traffic from the containers and injects it into
{{Arch}} as if it originated from the Docker application.

### Port Mapping

When you run a container with the `-p` argument, for example:

```console
$ docker run -p 80:80 -d nginx
```

Docker Desktop for {{Arch}} makes whatever is running on port 80 in the container (in
this case, `nginx`) available on port 80 of `localhost`. In this example, the
host and container ports are the same. What if you need to specify a different
host port? If, for example, you already have something running on port 80 of
your host machine, you can connect the container to a different port:

```console
$ docker run -p 8000:80 -d nginx
```

Now, connections to `localhost:8000` are sent to port 80 in the container. The
syntax for `-p` is `HOST_PORT:CLIENT_PORT`.

### HTTP/HTTPS Proxy Support

See [Proxies](index.md#proxies).

## Known limitations, use cases, and workarounds

Following is a summary of current limitations on the Docker Desktop for {{Arch}}
networking stack, along with some ideas for workarounds.

### Changing internal IP addresses

The internal IP addresses used by Docker can be changed via the Settings (Windows)
or Preferences (Mac). After changing IPs, it is necessary to reset the Kubernetes
cluster and to leave any active Swarm.

### There is no docker0 bridge on macOS

Because of the way networking is implemented in Docker Desktop for Mac, you cannot see a
`docker0` interface on the host. This interface is actually within the virtual
machine.

### I cannot ping my containers

Docker Desktop for Mac can't route traffic to containers.
<commit_msg>recovered ssh agent forwarding documentation<commit_after>---
description: Networking
keywords: mac, networking
redirect_from:
- /docker-for-mac/networking/
- /mackit/networking/
title: Networking features in Docker Desktop for Mac
---
{% assign Arch = 'Mac' %}

Docker Desktop for {{Arch}} provides several networking features to make it
easier to use.

## Features

### VPN Passthrough

Docker Desktop for {{Arch}}'s networking can work when attached to a VPN. To do this,
Docker Desktop for {{Arch}} intercepts traffic from the containers and injects it into
{{Arch}} as if it originated from the Docker application.

### Port Mapping

When you run a container with the `-p` argument, for example:

```console
$ docker run -p 80:80 -d nginx
```

Docker Desktop for {{Arch}} makes whatever is running on port 80 in the container (in
this case, `nginx`) available on port 80 of `localhost`. In this example, the
host and container ports are the same. What if you need to specify a different
host port? If, for example, you already have something running on port 80 of
your host machine, you can connect the container to a different port:

```console
$ docker run -p 8000:80 -d nginx
```

Now, connections to `localhost:8000` are sent to port 80 in the container. The
syntax for `-p` is `HOST_PORT:CLIENT_PORT`.

### HTTP/HTTPS Proxy Support

See [Proxies](index.md#proxies).

### SSH agent forwarding

Docker Desktop for Mac allows you to use the host’s SSH agent inside a container. To do this:

1. Bind mount the SSH agent socket by adding the following parameter to your `docker run` command:

    `--mount type=bind,src=/run/host-services/ssh-auth.sock,target=/run/host-services/ssh-auth.sock`

1. Add the `SSH_AUTH_SOCK` environment variable in your container:

    `-e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock"`

To enable the SSH agent in Docker Compose, add the following flags to your service:

 ```yaml
services:
  web:
    image: nginx:alpine
    volumes:
      - type: bind
        source: /run/host-services/ssh-auth.sock
        target: /run/host-services/ssh-auth.sock
    environment:
      - SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock
 ```

## Known limitations, use cases, and workarounds

Following is a summary of current limitations on the Docker Desktop for {{Arch}}
networking stack, along with some ideas for workarounds.

### Changing internal IP addresses

The internal IP addresses used by Docker can be changed via the Settings (Windows)
or Preferences (Mac). After changing IPs, it is necessary to reset the Kubernetes
cluster and to leave any active Swarm.

### There is no docker0 bridge on macOS

Because of the way networking is implemented in Docker Desktop for Mac, you cannot see a
`docker0` interface on the host. This interface is actually within the virtual
machine.

### I cannot ping my containers

Docker Desktop for Mac can't route traffic to containers.

{'fraction_non_alphanumeric': 0.08106485188150521, 'fraction_numerical': 0.010008006405124099, 'mean_word_length': 4.1997918834547345, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4706698', 'n_tokens_mistral': 1491, 'n_tokens_neox': 1348, 'n_words': 704}