Deploying Rocket.Chat with Docker and Docker Compose is as easy as it can get.
- If you don't have it already, make sure you have Docker and Docker-compose (v2 is required) installed and operational. To quickly do that you can use Docker's official helper script
curl -L https://get.docker.com | sh
- Add the current user to the docker group and reboot in order to run docker without using
sudo
by executing:
sudo usermod -aG docker $USER
sudo reboot
- Navigate to any directory of your choice and create a
docker-compose.yml
based on our example. OR you can download it directly by executing the following command on your terminal.
curl -L https://raw.githubusercontent.com/RocketChat/Docker.Official.Image/master/compose.yml -O
If you are using MongoDB Atlas as the database provider, edit the value of the MONGO_URL
variable in your compose file to be your connection string in this format
MONGO_URL=mongodb://<user>:<pass>@host1:27017,host2:27017,host3:27017/<databaseName>?replicaSet=<replicaSet>&ssl=true&authSource=admin
Environment variables are set using a .env
file. See the example here. If you cloned the repo initially, you can just rename the example file by
cp env.example .env
-
Set the
RELEASE
variable in the.env
to your desired Rocket.Chat version. See releases here.
Keeping the defaultlatest
is not recommended (More at Docker Images Available ) -
Edit
ROOT_URL
from the defaulthttp://localhost:3000
to match your domain name or IP address as you wish -
If you have a registration token to register the workspace automatically you can provide it with:
REG_TOKEN={your token here} docker-compose up -d
-
Next, start up the container by executing:
docker compose up -d
This is going to:
- Start a MongoDB service named
mongodb
. - Start a service
rocketchat
, that will also wait formongodb
to be ready.
Mongo supports 24 x 7 operations and live backup. You should not need to restart it too frequently. See MongoDB documentation for proper operation and management of a Mongo server.
Optionally, if you want to manage your messages and configuration information, edit the file again to uncomment the volume mounts. Make sure you have a data
subdirectory to mount and store the data.
To update the rocketchat
docker image to the latest version, update the RELEASE
value in your .env
file, then simply run docker compose up -d
. Your data should not be affected by this, since it's located in the mongo
image.
{% content-ref url="../../../../deploy/updating-rocket.chat/" %} updating-rocket.chat {% endcontent-ref %}