> ## Documentation Index
> Fetch the complete documentation index at: https://libops-renovate-github-com-libops-sitectl-0-x.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# port-forward

> Access Docker service ports on remote contexts that aren't exposed on the host.

export const Compose = () => <Tooltip headline="Compose" tip={<>
        Docker Compose is Docker's tool for defining and running multi-container applications.{" "}
        <a href="https://docs.docker.com/compose/">https://docs.docker.com/compose/</a>.
      </>}>
    <>
      <Icon icon="docker" />
      {" "}
      Compose
    </>
  </Tooltip>;

Remote services often don't expose ports directly on the VM — Solr, Traefik's dashboard, ActiveMQ, and similar admin interfaces are typically internal only. `port-forward` opens an SSH tunnel and maps those ports to localhost so you can reach them from your browser or local tools.

`port-forward` is a core `sitectl` command. It works from the active context and is not provided by an application plugin.

## Reference

Access remote context docker service ports.

For docker services running in remote contexts that do not have ports exposed on the host VM, accessing those services can be tricky.
The sitectl port-forward command can help in these situations.

As an example, from a local machine, accessing your stage context's traefik dashboard and solr admin UI
could be done by running this command in the terminal:

sitectl port-forward \
8983:solr:8983 \
8080:traefik:8080 \
8161:activemq:8161 \
`--context` stage

Then, while leaving the terminal open, in your web browser you can visit

[http://localhost:8983/solr](http://localhost:8983/solr) to see the solr admin UI
[http://localhost:8080/dashboard](http://localhost:8080/dashboard) to see the traefik dashboard (assuming it's enabled in your config)
[http://localhost:8161/admin/queues.jsp](http://localhost:8161/admin/queues.jsp) to see ActiveMQ queues

Be sure to run Ctrl+c in your terminal when you are done to close the connection.

```bash theme={null}
sitectl port-forward [LOCAL-PORT:SERVICE:REMOTE-PORT...]
```

## How it works

sitectl opens an SSH connection to the remote context's host and forwards each `LOCAL-PORT:SERVICE:REMOTE-PORT` mapping through that tunnel. The tunnel stays open until you press `Ctrl+C`.

Services are identified by their <Compose /> service name — sitectl resolves the container and port automatically.
