# Docker-compose not working properly

**URL:** <https://forums.rocket.chat/t/docker-compose-not-working-properly/14575>\
**Category:** Community Support\
**Created:** [July 28, 2022, 11:59am UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575 "2022-07-28T11:59:24Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbr13](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@mbr13](https://forums.rocket.chat/u/mbr13)\
**Post date:** [July 28, 2022, 11:59am UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/1 "2022-07-28T11:59:24Z")

</div>

### Description

Im trying to update my docker based Rocketchat containers [following the official Rocketchat instructions](https://docs.rocket.chat/quick-start/upgrading-rocket.chat#upgrading-rocket.chat-on-docker)

I want to upgrade from 4.2.0 to 4.8.1

The issue is that the command “sudo docker-compose stop rocketchat” goes through without giving me an error, but doesnt actually stop the rocketchat-related containers.

When I do an “sudo docker ps” after this, it tells me that the Rocketchat-Containers are still running.

and with “sudo docker-compose rm rocketchat” it only removes the weird “zmwadmin\_rocketchat\_1” container.

After that, the container default\_rocketchat\_1 does still exist and is running:

 ![2022-07-28_13-59](https://us1.discourse-cdn.com/flex021/uploads/rocketchat/original/2X/4/41510827ffac4b3b165778fde78b8c630044ba5f.jpeg)

This makes it kinda impossible for me to update our Rocketchat-Containers.  
Ive already tried removing the containers manually with “sudo docker rm default\_rocketchat\_1”, then building version 4.8.1 with “sudo-docker-compose up -d”, but this results in my Nginx Reverse Proxy giving me the message “502 Bad Gateway”.

Im not sure how I could fix this issue.

The docker-containers are stored directly in the Home-Path of user “zmwadmin”: /home/zmwadmin/  
As well as the docker-compose file: /home/zmwadmin/docker-compose.yml

### Server Setup Information

- Version of Rocket.Chat Server:
- Operating System: Ubuntu 22.04 LTS
- Deployment Method: Docker
- Number of Running Instances: 1
- DB Replicaset Oplog:
- NodeJS Version: v12.22.1
- MongoDB Version: 4.0.19 / mmapv1 (oplog activated)
- Proxy: Local Reverse Proxy is Nginx
- Firewalls involved: probably not

### Any additional Information

My docker-compose.yml:

> Blockquote  
> version: ‘2’

services:  
rocketchat:  
image: rocketchat/rocket.chat:4.2.0  
command: \>  
bash -c  
“for i in `seq 1 30`; do  
node main.js &&  
s=$$? && break || s=$$?;  
echo "Tried $$i times. Waiting 5 secs…";  
sleep 5;  
done; (exit $$s)”  
restart: unless-stopped  
volumes:  
- ./uploads:/app/uploads  
environment:  
- PORT=3000  
- ROOT\_URL=…  
- MONGO\_URL=…  
- MONGO\_OPLOG\_URL=…  
- MAIL\_URL=…

# - HTTP\_PROXY=…

# - HTTPS\_PROXY=…

```
depends_on:
  - mongo
ports:
  - 3000:3000
labels:
  - "traefik.backend=rocketchat"
  - "traefik.frontend.rule=Host: your.domain.tld"

```

mongo:  
image: mongo:4.0  
restart: unless-stopped  
volumes:  
- ./data/db:/data/db  
#- ./data/dump:/dump  
command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1  
labels:  
- “traefik.enable=false”

# this container’s job is just run the command to initialize the replica set.

# it will run the command and remove himself (it will not stay running)

mongo-init-replica:  
image: mongo:4.0  
command: \>  
bash -c  
“for i in `seq 1 30`; do  
mongo mongo/rocketchat --eval "  
rs.initiate({  
\_id: ‘rs0’,  
members: [{ \_id: 0, host: ‘localhost:27017’ }]})" &&  
s=$$? && break || s=$$?;  
echo "Tried $$i times. Waiting 5 secs…";  
sleep 5;  
done; (exit $$s)”  
depends\_on:  
- mongo

# hubot, the popular chatbot (add the bot user first and change the password before starting this image)

hubot:  
image: rocketchat/hubot-rocketchat:latest  
restart: unless-stopped  
environment:  
- ROCKETCHAT\_URL=this.ismydomain  
- ROCKETCHAT\_ROOM=GENERAL  
- ROCKETCHAT\_USER=bot  
- ROCKETCHAT\_PASSWORD=botpassword  
- BOT\_NAME=bot

# you can add more scripts as you’d like here, they need to be installable by npm

```
  - EXTERNAL_SCRIPTS=hubot-help,hubot-seen,hubot-links,hubot-diagnostics
depends_on:
  - rocketchat
labels:
  - "traefik.enable=false"
volumes:
  - ./scripts:/home/hubot/scripts

```

# this is used to expose the hubot port for notifications on the host on port 3001, e.g. for hubot-jenkins-notifier

```
ports:
  - 3001:8080

```

#traefik:

# image: traefik:latest

# restart: unless-stopped

# command: \>

# traefik

# –docker

# –acme=true

# –acme.domains=‘your.domain.tld’

# –acme.email=‘your@email.tld’

# –acme.entrypoint=https

# –acme.storagefile=acme.json

# –defaultentrypoints=http

# –defaultentrypoints=https

# –entryPoints=‘Name:http Address::80 Redirect.EntryPoint:https’

# –entryPoints=‘Name:https Address::443 TLS.Certificates:’

# ports:

# - 80:80

# - 443:443

# volumes:

# - /var/run/docker.sock:/var/run/docker.sock

zmwadmin@zmwrc:~$ version: ‘2’

services:  
rocketchat:  
image: rocketchat/rocket.chat:4.2.0  
command: \>  
bash -c  
“for i in `seq 1 30`; do  
node main.js &&  
s=$$? && break || s=$$?;  
echo "Tried $$i times. Waiting 5 secs…";  
sleep 5;  
done; (exit $$s)”  
restart: unless-stopped  
volumes:  
- ./uploads:/app/uploads  
environment:  
- PORT=3000  
- ROOT\_URL=…  
- MONGO\_URL=…  
- MONGO\_OPLOG\_URL=…  
- MAIL\_URL=…

# - HTTP\_PROXY=…

# - HTTPS\_PROXY=…

```
depends_on:
  - mongo
ports:
  - 3000:3000
labels:
  - "traefik.backend=rocketchat"
  - "traefik.frontend.rule=Host: your.domain.tld"

```

mongo:  
image: mongo:4.0  
restart: unless-stopped  
volumes:  
- ./data/db:/data/db  
#- ./data/dump:/dump  
command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1  
labels:  
- “traefik.enable=false”

# this container’s job is just run the command to initialize the replica set.

# it will run the command and remove himself (it will not stay running)

mongo-init-replica:  
image: mongo:4.0  
command: \>  
bash -c  
“for i in `seq 1 30`; do  
mongo mongo/rocketchat --eval "  
rs.initiate({  
\_id: ‘rs0’,  
members: [{ \_id: 0, host: ‘localhost:27017’ }]})" &&  
s=$$? && break || s=$$?;  
echo "Tried $$i times. Waiting 5 secs…";  
sleep 5;  
done; (exit $$s)”  
depends\_on:  
^C# - /var/run/docker.sock:/var/run/docker.sock.Certificates:‘https’ on port 3001, e.g. for hubot-jenkins-notifier

---

<div class="post-metadata">

**Author:** ![mbr13](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@mbr13](https://forums.rocket.chat/u/mbr13)\
**Post date:** [August 1, 2022, 6:58am UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/2 "2022-08-01T06:58:28Z")

</div>

bump, must be 20 characters

---

<div class="post-metadata">

**Author:** ![cestev](https://avatars.discourse-cdn.com/v4/letter/c/f1d935/32.png) [@cestev](https://forums.rocket.chat/u/cestev)\
**Post date:** [August 1, 2022, 3:46pm UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/3 "2022-08-01T15:46:58Z")

</div>

Hi maybe this is a silly answer. But are you sure you’re running the command in the right folder where your started your rocketchat instance?  
Why do you use sudo with docker-compose command? I run it as a regular user always.  
If you followed the tutorial for setup you may have passed the permissions to a user named rocketchat. Have you logged in with it?  
I hope some of this helps.

---

<div class="post-metadata">

**Author:** ![dudanogueira](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/dudanogueira/32/2529_2.png) [@dudanogueira](https://forums.rocket.chat/u/dudanogueira)\
**Post date:** [August 1, 2022, 7:04pm UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/4 "2022-08-01T19:04:11Z")

</div>

Hi!

Upgrading should be something like:

1. edit docker-compose.yml
2. change the server image tag to the version you want, something like, in your case:  
**from** : rocketchat/rocket.chat:4.2.0  
**to** : rocketchat/rocket.chat:4.8.2

now you need to grab the latest version, so:  
3) docker-compose pull

and finally:  
4) docker-compose up -d

please, always backup everything before migrating 🙂

---

<div class="post-metadata">

**Author:** ![mbr13](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@mbr13](https://forums.rocket.chat/u/mbr13)\
**Post date:** [August 2, 2022, 6:28am UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/5 "2022-08-02T06:28:56Z")

</div>

Hi, I managed to get rid of the containers including “zmwadmin”. Rocketchat still responded correctly after removing those. Now only the “default” containers are left.

I also managed to update the Rocketchat-Container default\_rocketchat\_1 to the latest version.  
All containers are running but my Nginx-Reverse-Proxy gives me an “502 Bad Gateway”.

What I did was the following:

1. Stopping all related containers
2. Removed “zmwadmin”-Containers
3. Changed directory to /
4. Edited the tag rocketchat:4.2.0 to rocketchat:latest
5. docker-compose pull
6. docker-compose up -d

/var/log/nginx/rocketchat.access.log shows me the follwing errors when trying to reach the Rocketchat-URL:

```auto
2022/08/02 06:24:32 [error] 2332#2332: *1 recv() failed (104: Unknown error) while reading response header from upstream, client: 172.22.4.34, server: some.domain.de:57300, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:3000/favicon.ico", host: "some.domain.de:57300", referrer: "https://some.domain.de:57300/"
2022/08/02 06:24:34 [error] 2332#2332: *1 recv() failed (104: Unknown error) while reading response header from upstream, client: 172.22.4.34, server: some.domain.de:57300, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "some.domain.de:57300"
2022/08/02 06:24:34 [error] 2332#2332: *1 recv() failed (104: Unknown error) while reading response header from upstream, client: 172.22.4.34, server: some.domain.de:57300, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:3000/favicon.ico", host: "some.domain.de:57300", referrer: "https://some.domain.de:57300/"

```

---

<div class="post-metadata">

**Author:** ![cestev](https://avatars.discourse-cdn.com/v4/letter/c/f1d935/32.png) [@cestev](https://forums.rocket.chat/u/cestev)\
**Post date:** [August 2, 2022, 12:25pm UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/6 "2022-08-02T12:25:01Z")

</div>

won’t latest tag download Rocket.Chat version 5.0.0?  
If it does it does no longer support your mongo version as it looks from your first post you have version 4.0…  
The release note from RC 5.0.0 states:  
MongoDB: 4.2, 4.4, 5.0 are supported

If you run “docker ps” command, does it show your chat running?

---

<div class="post-metadata">

**Author:** ![dudanogueira](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/dudanogueira/32/2529_2.png) [@dudanogueira](https://forums.rocket.chat/u/dudanogueira)\
**Post date:** [August 2, 2022, 5:15pm UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/7 "2022-08-02T17:15:28Z")

</div>

your upstream should point to something like [http://rocketchat:3000](http://rocketchat:3000)

I prefer using traefik for reverse proxying. Here is a nice example I use:

> **[GitHub - dudanogueira/rocketconnect.cookiecutter: Awesome Open Sources...](https://github.com/dudanogueira/rocketconnect.cookiecutter)**
>
> Awesome Open Sources Projects. Easy Deployment. Contribute to dudanogueira/rocketconnect.cookiecutter development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![mbr13](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@mbr13](https://forums.rocket.chat/u/mbr13)\
**Post date:** [August 3, 2022, 5:13am UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/8 "2022-08-03T05:13:49Z")

</div>

@cestev My Rocketchat-Containers including MongoDB are up when using the tag :latest

 ![2022-08-03_07-07](https://us1.discourse-cdn.com/flex021/uploads/rocketchat/original/2X/9/90de7cecf64311fe2de09fc47c7ade54a246c304.jpeg)

@dudanogueira Ive tried changing the upstream URL to any combination of [http://localhost:3000](http://localhost:3000) and when restarting nginx it always gave me the following error:

```auto
Aug 03 05:01:34 zmwrc nginx[2285]: nginx: [emerg] invalid host in upstream "http://127.0.0.1:3000" in /etc/nginx/sites-enabled/default:3

```

Switching over to traefik as my reverse proxy isnt an option for me. Im working as a sysadmin and im already struggling to maintain our current docker-based rocketchat instance, as I have no deep understanding to how docker works.  
When I installed rocketchat via docker it was officially suggested to use nginx as the local reverse proxy instead of directly connecting to the unencrypted rocketchat-container via port tcp/3000. Given Nginx-config was also provided by the rocketchat documentation.

---

<div class="post-metadata">

**Author:** ![dudanogueira](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/dudanogueira/32/2529_2.png) [@dudanogueira](https://forums.rocket.chat/u/dudanogueira)\
**Post date:** [August 3, 2022, 12:53pm UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/9 "2022-08-03T12:53:57Z")

</div>

HI!

the address of the upstream will depend on how your servers are setup.

I suspect you added **[http://127.0.0.1:3000](http://127.0.0.1:3000)** at the upstream, while you only need the **127.0.0.1:3000** (without http://)

you should add the protocol at the proxy\_pass directive inside the _location / {}_ section

---

<div class="post-metadata">

**Author:** ![mbr13](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@mbr13](https://forums.rocket.chat/u/mbr13)\
**Post date:** [August 5, 2022, 5:12am UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/10 "2022-08-05T05:12:35Z")

</div>

Oh, sorry I probably misunderstood what you meant.

My proxy\_pass is already configured to point towards 127.0.0.1:3000

I believe it makes sense to post my full Nginx-Config here, so here it is:

cat /etc/nginx/sites-enabled/default

```auto
# Upstreams
upstream backend {
    server 127.0.0.1:3000;
}

# HTTPS Server
server {
    listen 443;
    server_name zmwrc.somedomain.de:57300;

    # You can increase the limit if your need to.
    client_max_body_size 200M;

    error_log /var/log/nginx/rocketchat.access.log;

    ssl on;
    ssl_certificate /etc/nginx/wildcard.cer;
    ssl_certificate_key /etc/nginx/wildcard.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # don’t use SSLv3 ref: POODLE

    location / {
        proxy_pass http://backend;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;

        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Nginx-Proxy true;

        proxy_redirect off;
    }
}

```

I also tried to set proxy\_pass directly to [http://127.0.0.1:3000](http://127.0.0.1:3000) but the result was the same when connecting to the Nginx Reverse Proxy from my Browser: 502 Bad Gateway

---

<div class="post-metadata">

**Author:** ![dudanogueira](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/dudanogueira/32/2529_2.png) [@dudanogueira](https://forums.rocket.chat/u/dudanogueira)\
**Post date:** [August 11, 2022, 4:05pm UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/11 "2022-08-11T16:05:33Z")

</div>

Hi!

can you state the NGINX version you are running?

Maybe it’s an old version. The problem here is that its saying the nginx confi file is invalid.

---

<div class="post-metadata">

**Author:** ![mbr13](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@mbr13](https://forums.rocket.chat/u/mbr13)\
**Post date:** [August 26, 2022, 7:13am UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/12 "2022-08-26T07:13:50Z")

</div>

Hi, sorry for the late reply, I was on holidays 🙂

```auto
nginx -v 

```

shows me the following output:

```auto
nginx version: nginx/1.18.0 (Ubuntu)

```

According to my 2 seconds of research, this should be the latest stable version for nginx as of now.

---

<div class="post-metadata">

**Author:** ![dudanogueira](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/dudanogueira/32/2529_2.png) [@dudanogueira](https://forums.rocket.chat/u/dudanogueira)\
**Post date:** [August 26, 2022, 12:42pm UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/13 "2022-08-26T12:42:48Z")

</div>

If you run nginx -t, what will it bring?

This is certainly some validation error in NGNIX

---

<div class="post-metadata">

**Author:** ![mbr13](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@mbr13](https://forums.rocket.chat/u/mbr13)\
**Post date:** [August 31, 2022, 8:13am UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/14 "2022-08-31T08:13:57Z")

</div>

nginx -t gives me the following output:

```auto
nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/sites-enabled/default:16
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

```

Line 16 is where the Config-File “default” says:

```auto
ssl on;

```

---

<div class="post-metadata">

**Author:** ![mbr13](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@mbr13](https://forums.rocket.chat/u/mbr13)\
**Post date:** [September 21, 2022, 9:59am UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/15 "2022-09-21T09:59:36Z")

</div>

Bump

Theres one more question regarding business support.  
We contacted the Rocketchat Business Support a month ago as suggested here:

> **[Talk to an expert](https://de.rocket.chat/sales-contact)**
>
> Talk to our team of experts without any obligation and find out how Rocket.Chat can help you reap the benefits of optimized, yet secure team collaboration.

Nobody replied to our form though… ☹  
What can we do to get Business Support for our on-prem Rocketchat Instance?

---

<div class="post-metadata">

**Author:** ![dudanogueira](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/dudanogueira/32/2529_2.png) [@dudanogueira](https://forums.rocket.chat/u/dudanogueira)\
**Post date:** [September 21, 2022, 1:49pm UTC](https://forums.rocket.chat/t/docker-compose-not-working-properly/14575/16 "2022-09-21T13:49:32Z")

</div>

Hi! Commercial support is only available for Enterprise Edition licensed workspaces. If you do have EE, you can reach our support at [https://support.rocket.chat/](https://support.rocket.chat/)

Bear in mind that this is not actually a Rocket.Chat issue, but a deployment one.

please feel free to [ping me at our open](https://open.rocket.chat/direct/duda.nogueira) so I can take a closer look.
