---
slug: /user/quickstart/532928/up
hide_table_of_contents: true
title: "Expose services returned by a function on the host"
---

# Quickstart

## Expose services returned by a function on the host

The `dagger up` command allows `Service` types returned by a function to be executed and have any exposed ports forwarded to the host machine.

This has many potential use cases, such as manually testing web servers or databases directly from the host browser or host system.

:::note
In order for this to work, the service returned by the function must have the `Container.withExposedPort` field defining one or more exposed ports.
:::

### Expose a service

Use the `dagger up` command to build the React application and serve it with NGINX:

```shell
dagger up --native service
```

You should now be able to access the application by browsing to `http://localhost:8080` on the host (replace `localhost` with your Docker host's network name if accessing it remotely).

### Expose a service on a different port

The `--native` flag results in the exposed ports on the container being auto-mapped to the host when setting up network listeners on your host. The example module exposes the service on container port 8080, which is why the service is available on host port 8080.

However, you can modify this behavior and choose a different port on your host via the `--port` flag. For example:

```shell
dagger up --port 9090:8080 service
```

This results in container port 8080 being mapped to host port 9090. You should now be able to access the application by browsing to `http://localhost:9090` (or equivalent host name) on the host.

:::tip
Here is an example of using this command with a module from the [Daggerverse](https://daggerverse.dev/):

- `dagger up --native --mod github.com/helderco/daggerverse/python@kcna23 http-server --src <path/to/web/assets>`
  - Module information: https://github.com/helderco/daggerverse/tree/main/python/kcna23
:::
