Naman Gupta
Naman Gupta

Reputation: 39

How to change default port of rocket chat server installed using docker?

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?

Upvotes: 0

Views: 3069

Answers (3)

Harshit Chawla
Harshit Chawla

Reputation: 113

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" 

Upvotes: 3

Fendi jatmiko
Fendi jatmiko

Reputation: 2895

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

Upvotes: 1

yamenk
yamenk

Reputation: 51738

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.

Upvotes: 5

Related Questions