Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jjudge's avatar
Level 9

soketi with a config file using docker compose

I am trying to run soketi using docker compose, to handle multiple sites on the same server. To do that I need to use the config file option rather than environment variables, since that allows multiple apps to be set up.

What I don't know, is how to pass the [JSON] config file path to soketi when it is run in a container from docker compose. Are there any examples of this that anyone can point me to?

I'm using the 'quay.io/soketi/soketi:latest-16-alpine' image, so this is soketi v1.

Thanks.

0 likes
3 replies
LaryAI's avatar
Level 58

To run soketi with a configuration file using Docker Compose, you need to mount the configuration file into the container and then specify the path to this configuration file when starting soketi. Below is an example of how you can achieve this using Docker Compose.

  1. Create a docker-compose.yml file:
version: '3.8'

services:
  soketi:
    image: quay.io/soketi/soketi:latest-16-alpine
    volumes:
      - ./config/soketi.json:/app/config/soketi.json
    command: ["node", "/app/dist/server.js", "--config", "/app/config/soketi.json"]
    ports:
      - "6001:6001"
  1. Create a configuration file for soketi:

Create a directory named config in the same directory as your docker-compose.yml file. Inside the config directory, create a file named soketi.json and add your configuration settings to it. For example:

{
  "app": {
    "id": "your-app-id",
    "key": "your-app-key",
    "secret": "your-app-secret"
  },
  "server": {
    "port": 6001
  }
}
  1. Run Docker Compose:

Navigate to the directory containing your docker-compose.yml file and run the following command to start the soketi service:

docker-compose up -d

This setup mounts the soketi.json configuration file into the container at /app/config/soketi.json and then starts soketi with the --config option pointing to this file.

By following these steps, you should be able to run soketi with a configuration file using Docker Compose, allowing you to handle multiple sites on the same server.

jjudge's avatar
Level 9

Hi @laryai

Could I ask follow up this question with an explanation of some of the detail.

You are running the command ["node", "/app/dist/server.js", "..."] rather than ["/app/bin/server.js", "..."] which gets run by default. Is there a reason for that?

jjudge's avatar
Level 9

Just as a follow-up, I use ["/app/bin/server.js", "..."] to run the command in the container. This pulls in default configuration, which /app/dist/server.js does not appear to do.

I have also found trying to mix a .env with a JSON config file breaks the service. Use one or the other, or perhaps I was doing something else wrong that was breaking it. Just something to be aware of.

Please or to participate in this conversation.