> ## Documentation Index
> Fetch the complete documentation index at: https://ngrok.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Using ngrok with Docker Compose

> Learn how to put your apps and services online using ngrok with Docker Compose.

If you're more comfortable using Docker Compose, you can use the following as a starting point. Copy the contents below into a new file named `docker-compose.yaml`, then run `docker compose up` in that directory.

This Docker compose file assumes that you have an `ngrok.yml` file in the same directory with at least one tunnel defined. Check out the [ngrok agent config file documentation](/agent/config/) for help creating a configuration file with a tunnel definition. If you want to use the same configuration file as your local ngrok agent, you can view the location of the default config file using `ngrok config check`.

```yaml theme={null}
services:
  ngrok:
    image: ngrok/ngrok:latest
    restart: unless-stopped
    command:
      - "start"
      - "--all"
      - "--config"
      - "/etc/ngrok.yml"
    volumes:
      - ./ngrok.yml:/etc/ngrok.yml
    ports:
      - 4040:4040
```

If you're defining your tunnels directly in `docker-compose.yaml` rather than using an `ngrok.yml` file the configuration will look a little different. Your command will be running an `ngrok http` command and you'll be using the special URL `host.docker.internal` as mentioned in the note above. The following is an example of using the ngrok along with the `dockersamples/static-site` image.

```yaml theme={null}
services:
  static-site:
    image: dockersamples/static-site
    build: .
    ports:
      - "80:80"
    restart: always
  ngrok:
    image: ngrok/ngrok:latest
    command:
      - "http"
      - "http://host.docker.internal:80"
    environment:
      NGROK_AUTHTOKEN: ${NGROK_AUTHTOKEN}
    ports:
      - 4040:4040
```
