Skip to main content

tuna and Docker

You can run the tunnel as a separate container next to your app. tuna reaches the app by its Docker Compose service name, so you don't need to publish the app's port on the host.

Step 1. Create an API key​

A container has no browser for tuna login, so tuna signs in with an API key. Create an API key with the "For tunnels" preset and save it to a .env file next to compose.yml:

.env
TUNA_API_KEY=<your_key>

Step 2. Describe the services​

In this example, the app is whoami, a test web server that responds with the request details. Replace it with your own app and port:

compose.yml
services:
web:
image: traefik/whoami
tuna:
image: yuccastream/tuna:latest
command: http web:80
restart: always
environment:
TUNA_API_KEY: ${TUNA_API_KEY}
depends_on:
- web

Step 3. Start it​

docker compose up -d
docker compose logs tuna

Find the Forwarding line in the tuna log: the url field holds the public tunnel address.

To stop and remove the containers:

docker compose down

Inspector​

In the official yuccastream/tuna image, the Request Inspector is off by default: nobody usually opens it in a container. To turn it on and open it from outside the container, see Inspector in Docker.

tuna on the host​

If tuna is installed on the machine itself rather than in a container, publish the app's port and point the tunnel at it:

compose.yml
services:
web:
image: traefik/whoami
ports:
- 127.0.0.1:8000:80
tuna http 8000