Installing rocket.chat with docker-compose. Unable to connect localhost:300

forgive me I am kind of new to this so I probably made a number of stupid mistakes. I am trying to launch Rocket.chat utilizing docker-compose. when I start it using,

docker compose up -d

everything works shows to be working fine when I run “docker ps” the instance shows as running along side mongodb as is expected.

CONTAINER ID   IMAGE                                         COMMAND                  CREATED          STATUS                          PORTS                                                                                            NAMES
bb70fb9b5021   registry.rocket.chat/rocketchat/rocket.chat   "docker-entrypoint.s…"   16 minutes ago   Up 2 seconds                    0.0.0.0:3000->3000/tcp                                                                           docker-rocketchat-1
0cf1dbd4cbb0   bitnami/mongodb:4.4                           "/opt/bitnami/script…"   49 minutes ago   Restarting (1) 44 seconds ago                                                                                                    docker-mongodb-1

but then when I try and access it over my network with “localhost:3000” or “192.168.1.134:3000” it is unable to connect.

I suspect the issue is in my compose.yml file as I definitely did not fully understand what I was doing while I modified it. I just tried to follow the instructions on some tutorials. this is my compose.yml file,

volumes:
  mongodb_data: { driver: local }

services:
  rocketchat:
    image: registry.rocket.chat/rocketchat/rocket.chat
    restart: on-failure
    labels:
      traefik.enable: "true"
      traefik.http.routers.rocketchat.rule: Host(192.164.1.134)
      traefik.http.routers.rocketchat.tls: "true"
      traefik.http.routers.rocketchat.entrypoints: https
      traefik.http.routers.rocketchat.tls.certresolver: le
    environment:
      MONGO_URL: "${MONGO_URL:mongodb://localhost:27017\
        mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/\
        ${MONGODB_DATABASE:-rocketchat}?replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}}"
      MONGO_OPLOG_URL: "${MONGO_OPLOG_URL:\
        -mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/\
        local?replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}}"
      ROOT_URL: http://0.0.0.0:3000
      PORT: $${3000:3000}
      DEPLOY_METHOD: docker
      DEPLOY_PLATFORM: ${Linux}
    depends_on:
      - mongodb
    expose:
      - ${PORT:-3000}
    ports:
      - "${BIND_IP:-0.0.0.0}:${HOST_PORT:-3000}:${PORT:-3000}"

  mongodb:
    image: docker.io/bitnami/mongodb:${MONGODB_VERSION:-4.4}
    restart: on-failure
    volumes:
      - mongodb_data:/bitnami/mongodb
    environment:
      MONGODB_REPLICA_SET_MODE: primary
      MONGODB_REPLICA_SET_NAME: ${MONGODB_REPLICA_SET_NAME:-rs0}
      MONGODB_PORT_NUMBER: ${MONGODB_PORT_NUMBER:-27017}
      MONGODB_INITIAL_PRIMARY_HOST: ${MONGODB_INITIAL_PRIMARY_HOST:-mongodb}
      MONGODB_INITIAL_PRIMARY_PORT_NUMBER: ${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}
      MONGODB_ADVERTISED_HOSTNAME: ${MONGODB_ADVERTISED_HOSTNAME:-mongodb}
      MONGODB_ENABLE_JOURNAL: ${MONGODB_ENABLE_JOURNAL:-true}
      ALLOW_EMPTY_PASSWORD: $${ALLOW_EMPTY_PASSWORD:-yes

the changes I made are the rocket chat image has been changed from latest to the current stable release.

“traefik.http.routers.rocketchat.rule: Host(192.164.1.134)”
OG had " Host(${DOMAIN})"
The tutorials didn’t tell me what to put here but when I tried to run it without moding it it kept flagging it say “domain” was undefined.

"MONGO_URL: "${MONGO_URL:mongodb://localhost:27017"
OG "MONGO_URL: "${MONGO_URL:-"

“ROOT_URL: http://0.0.0.0:3000
OG “ROOT_URL: ${ROOT_URL:-http://localhost:${HOST_PORT:-3000}}”

Deploy_platform I’ll be honest I do not know what I am supposed to input here so far nothing has worked but I have “DEPLOY_PLATFORM: ${Linux}”

the only other change I made was a few of the lines had an issue with “$” and according to what I found online the solution is to add a second “$” so that is what I did. in the file I pulled from git none of the lines had 2 “$” so I am not sure if that was the right thing to do.

oh also this is running on docker on a Ubuntu VM in Proxmox.

If you compare the original file and your modification, you should immediatly be able to spot some problems:

The compose file expects you to use an .env file (in the same folder as the compose.yml) - here is the github repo that shows how the file should look like: GitHub - RocketChat/Docker.Official.Image: OFFICIAL REPOSITORY rocket.chat

line 6: are you sure the repo has a latest tag?
line 10: the host name or ip must be surrounded with backticks, like you can see on the left side
line 15-17: revert your change and use an .env file to fill in the variable
line 18-20: use an .env file to fill in the variable
line 21: this is the ip rocketchat will report to the clients, use your public ip or the host ip instead of 0.0.0.0
line 22: correct $, incorrect: $$. Remove one $
line 45: correct $, incorrect: $$. Remove one $. Also clossing bracket is missing.

Basicly: throw away your file, start with the clean compose.yml and use an .env file to assign the values.

1 Like

all the tutorials I was following conveniently skated right on past creating the .env file but that was definitely the issue. thanks for the help.