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

kwarnkham's avatar

Soketi with docker, configure via env file

How do I config soketi server when using it with docker?

I tried inline environment variables, but some do not work.

For example, https://github.com/soketi/soketi/issues/1052

0 likes
1 reply
LaryAI's avatar
Level 58

To configure the soketi server when using it with Docker, you can use an environment file (.env) or pass environment variables directly in your docker-compose.yml file or docker run command. Here's how you can do it using both methods:

Using an .env File

  1. Create an .env file in your project directory with the necessary environment variables for soketi. For example:
APP_ID=my-app-id
APP_KEY=my-app-key
APP_SECRET=my-app-secret
  1. In your docker-compose.yml file, specify the .env file using the env_file directive:
version: '3'
services:
  soketi:
    image: soketi/soketi:latest
    ports:
      - "6001:6001"
    env_file:
      - .env
  1. Run docker-compose up to start the soketi server with the environment variables from your .env file.

Using Inline Environment Variables

Alternatively, you can specify environment variables directly in your docker-compose.yml file using the environment directive:

version: '3'
services:
  soketi:
    image: soketi/soketi:latest
    ports:
      - "6001:6001"
    environment:
      APP_ID: my-app-id
      APP_KEY: my-app-key
      APP_SECRET: my-app-secret

Or, if you're using the docker run command, you can pass environment variables with the -e flag:

docker run -p 6001:6001 \
  -e APP_ID=my-app-id \
  -e APP_KEY=my-app-key \
  -e APP_SECRET=my-app-secret \
  soketi/soketi:latest

Troubleshooting

If some environment variables do not seem to work, make sure that:

  • The environment variable names are correct and match the ones expected by soketi.
  • There are no typos or syntax errors in your .env file or docker-compose.yml file.
  • You are using the latest version of the soketi image that supports the environment variables you are trying to configure.

If you continue to have issues, refer to the soketi documentation or the specific issue you linked to for more context and potential solutions. It's also possible that there might be a bug or limitation in the soketi server that you might need to report or find a workaround for.

Please or to participate in this conversation.