refactor(docker-compose): Set UID/GID (#1044)

* Adding UID, GID to prevent permission problems when running docker compose
as user and not as root.

* Update docker_install.md

Add comment on pre-creating volume mount directories.

---------

Co-authored-by: Erich Focht <efocht@gmail.com>
Co-authored-by: Erich Focht <efocht@users.noreply.github.com>
This commit is contained in:
Marco Beretta 2023-10-13 23:24:27 +02:00 committed by GitHub
parent 909cbb8529
commit e7e473d335
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View file

@ -67,6 +67,11 @@ LIMIT_MESSAGE_USER=false # Whether to limit the amount of messages an IP can sen
MESSAGE_USER_MAX=40 # The max amount of messages an IP can send per MESSAGE_USER_WINDOW MESSAGE_USER_MAX=40 # The max amount of messages an IP can send per MESSAGE_USER_WINDOW
MESSAGE_USER_WINDOW=1 # in minutes, determines the window of time for MESSAGE_USER_MAX messages MESSAGE_USER_WINDOW=1 # in minutes, determines the window of time for MESSAGE_USER_MAX messages
# If you have permission problems, set here the UID and GID of the user running
# the docker compose command. The applications in the container will run with these uid/gid.
UID=1000
GID=1000
# Change this to proxy any API request. # Change this to proxy any API request.
# It's useful if your machine has difficulty calling the original API server. # It's useful if your machine has difficulty calling the original API server.
# PROXY= # PROXY=

View file

@ -25,6 +25,7 @@ services:
target: node # ^------v target: node # ^------v
# image: ghcr.io/danny-avila/librechat:latest # Uncomment this & comment above to build from docker hub image # image: ghcr.io/danny-avila/librechat:latest # Uncomment this & comment above to build from docker hub image
restart: always restart: always
user: "${UID}:${GID}"
extra_hosts: # if you are running APIs on docker you need access to, you will need to uncomment this line and next extra_hosts: # if you are running APIs on docker you need access to, you will need to uncomment this line and next
- "host.docker.internal:host-gateway" - "host.docker.internal:host-gateway"
env_file: env_file:
@ -50,6 +51,7 @@ services:
# - 27018:27017 # - 27018:27017
image: mongo image: mongo
restart: always restart: always
user: "${UID}:${GID}"
volumes: volumes:
- ./data-node:/data/db - ./data-node:/data/db
command: mongod --noauth command: mongod --noauth
@ -61,6 +63,7 @@ services:
# - 7700:7700 # if exposing these ports, make sure your master key is not the default value # - 7700:7700 # if exposing these ports, make sure your master key is not the default value
env_file: env_file:
- .env - .env
user: "${UID}:${GID}"
environment: environment:
- MEILI_HOST=http://meilisearch:7700 - MEILI_HOST=http://meilisearch:7700
- MEILI_HTTP_ADDR=meilisearch:7700 - MEILI_HTTP_ADDR=meilisearch:7700

View file

@ -32,6 +32,11 @@ How to set up the user/auth system and Google login.
### Running LibreChat ### Running LibreChat
Once you have completed all the setup, you can start the LibreChat application by running the command `docker-compose up` in your terminal. After running this command, you can access the LibreChat application at `http://localhost:3080`. Once you have completed all the setup, you can start the LibreChat application by running the command `docker-compose up` in your terminal. After running this command, you can access the LibreChat application at `http://localhost:3080`.
If you build your own containers out of the git checkout with `docker up -d --build` you should pre-create the mount points for the volumes. This avoids occasional trouble with directory permissions when rebuilding:
```
mkdir meili_data images .env.production .env.development data-node
```
**Note:** MongoDB does not support older ARM CPUs like those found in Raspberry Pis. However, you can make it work by setting MongoDBs version to mongo:4.4.18 in docker-compose.yml, the most recent version compatible with **Note:** MongoDB does not support older ARM CPUs like those found in Raspberry Pis. However, you can make it work by setting MongoDBs version to mongo:4.4.18 in docker-compose.yml, the most recent version compatible with
That's it! If you need more detailed information on configuring your compose file, see my notes below. That's it! If you need more detailed information on configuring your compose file, see my notes below.