Development with Docker
Inngest provides a Docker image that you can use to run the Inngest Dev Server within a container. This is useful when running Inngest locally or in a CI/CD environment.
This guide will explain how to run Inngest using Docker or Docker Compose.
Docker image
The inngest/inngest image is available on Docker Hub. Regular updates are made to this image, so we recommend pulling the latest version. You can find the latest version release on our Github repo.
docker pull inngest/inngest
Standalone Docker container
Docker can be useful for running the Inngest Dev Server in a standalone container. This is useful if you do not want to use the npx inngest-cli@latest method to run the Dev Server.
To run the Inngest container, you'll need to:
- Expose the Dev Server port (default is
8288). - Use the
inngest devcommand with the-uflag to specify the URL where Inngest can find your app.
In this example command, our app is running on the host machine on port 3000. We use the host.docker.internal hostname to connect to the host machine from within the Docker container. For ease of reading, the command is broken up into multiple lines.
docker run -p 8288:8288 \
inngest/inngest \
inngest dev -u http://host.docker.internal:3000/api/inngest
You will then be able to access the Inngest Dev Server on your host machine at http://localhost:8288 or whatever hostname you have configured. You may need to adjust the hostname for your app if you are using a different Docker network setup.
If you decide to run the Dev Server on another port, you will need to set the INNGEST_BASE_URL environment variable in your app to point to the correct port. This value defaults to http://localhost:8288.
Docker Compose
If you're using Docker Compose to run your services locally, you can easily add Inngest to your local environment. Here's an example docker-compose.yml file that includes Inngest:
docker-compose.yaml
services:
app:
build: ./app
environment:
- INNGEST_DEV=1
- INNGEST_BASE_URL=http://inngest:8288
ports:
- '3000:3000'
inngest:
image: inngest/inngest:v0.27.0
command: 'inngest dev -u http://app:3000/api/inngest'
ports:
- '8288:8288'
In this example, we have two services: app and inngest. The app service is your application, and the inngest service is the Inngest Dev Server. There are a few key configurations to note:
- The
INNGEST_DEV=1environment variable tells the Inngest SDK it should connect to the Dev Server*. - The
INNGEST_BASE_URL=http://inngest:8288environment variable tells the Inngest SDK where the Dev Server is running. In our example, theinngestservice is running on port8288(the default Dev Server port). - The
command: 'inngest dev -u http://app:3000/api/inngest'command tells the Dev Server where to find your app within the Docker network. In this example, theappservice is running on port3000. - The
portsconfiguration exposes the Dev Server on port8288so you can view this on your host machine in the browser.
* - The INNGEST_DEV environment variable was added to the TypeScript SDK in version 3.14. Prior to this version, you can set NODE_ENV=development to force the SDK to connect to the Dev Server.