0

I have used docker to install Rocket.Chat on my instance. By default it runs on port number 3000 but i want to run it on the other port.

My docker-compose.yml file looks like: https://github.com/RocketChat/Rocket.Chat/blob/develop/docker-compose.yml

How can i run it on different port?

Naman Gupta
  • 39
  • 2
  • 12

3 Answers3

5

You need to change the port mapping between the host and the container. Just update the docker-comopse file and change the following section:

ports:
  - <host-port>:3000

Just update the <host-port> above to the port that you want.

yamenk
  • 46,736
  • 10
  • 93
  • 87
3

Running with command:

docker container run -p Your_desired_local_port:3000 rocketchat/rocket.chat:latest

but rocket chat require mongo to be running first so you have to have a running mongo-db container on the same network or you do a docker-compose.

Running with docker-compose you just need to add the new port in docker-compose file in below mentioned places.

 services:
  rocketchat:
    image: rocketchat/rocket.chat:latest
    restart: unless-stopped
    volumes:
      - ./uploads:/app/uploads
    environment:
      - PORT=  ADD THE NEW PORT HERE
      - ROOT_URL=http://localhost:ADD THE NEW PORT HERE
      - MONGO_URL=mongodb://mongo:27017/rocketchat
      - MONGO_OPLOG_URL=mongodb://mongo:27017/local
      - MAIL_URL=smtp://smtp.email
    depends_on:
      - mongo
    ports:
      - ADD THE NEW PORT HERE:3000
    labels:
      - "traefik.backend=rocketchat"
      - "traefik.frontend.rule=Host: your.domain.tld" 
Harshit Chawla
  • 113
  • 1
  • 9
1

just change the port that related to your rocketchat service to your desired port, for instance, if you wanna use port 8181 services: rocketchat: image: rocketchat/rocket.chat:latest restart: unless-stopped volumes: - ./uploads:/app/uploads environment: - PORT=8181 - ROOT_URL=http://localhost:8181

... ports: - 8181:8181 ... restart: unless-stopped environment: - ROCKETCHAT_URL=rocketchat:8181

and change all 3000 port to 8181

let me know if its doesnt work

Fendi jatmiko
  • 2,567
  • 1
  • 9
  • 15