# New bug with running SP-7 on Docker

**URL:** <https://speciforum.org/t/new-bug-with-running-sp-7-on-docker/1535>\
**Category:** Get Help\
**Created:** [February 1, 2024, 4:13pm UTC](https://speciforum.org/t/new-bug-with-running-sp-7-on-docker/1535 "2024-02-01T16:13:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Heryk](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/heryk/32/5730_2.png) [@Heryk](https://speciforum.org/u/Heryk)\
**Post date:** [February 1, 2024, 4:13pm UTC](https://speciforum.org/t/new-bug-with-running-sp-7-on-docker/1535/1 "2024-02-01T16:13:34Z")

</div>

Hello,  
I have been using a containerized version of SP-7 (all in one) for several months with Docker without issues. I stopped using Docker last automne to explore Podman. However, for specific needs in need to redeploy SP-7 with Docker again… but I can’t get it to work properly as before. I get a 502 Bad Gateway error message in my web browser. All containers are running… but NGINX has some error messages in the logs.

> 2024-02-01 10:46:55 2024/02/01 15:46:55 [error] 22#22: \*1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.21.0.1, server: localhost, request: “GET /web\_asset\_store.xml HTTP/1.1”, upstream: “[http://0.0.0.0:8080/web\_asset\_store.xml](http://0.0.0.0:8080/web_asset_store.xml)”, host: “host.docker.internal:8090”  
> 2024-02-01 10:46:57 2024/02/01 15:46:57 [error] 26#26: \*3 connect() failed (111: Connection refused) while connecting to upstream, client: 172.21.0.1, server: localhost, request: “GET /web\_asset\_store.xml HTTP/1.1”, upstream: “[http://0.0.0.0:8080/web\_asset\_store.xml](http://0.0.0.0:8080/web_asset_store.xml)”, host: “host.docker.internal:8090”  
> 2024-02-01 10:47:00 2024/02/01 15:47:00 [error] 21#21: \*5 connect() failed (111: Connection refused) while connecting to upstream, client: 172.21.0.1, server: localhost, request: “GET / HTTP/1.1”, upstream: “[http://0.0.0.0:8000/](http://0.0.0.0:8000/)”, host: “localhost:8090”

I reviewed all my code and all seems ok. Any idea of what could be going wrong here?  
Thanks

---

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [February 1, 2024, 4:56pm UTC](https://speciforum.org/t/new-bug-with-running-sp-7-on-docker/1535/2 "2024-02-01T16:56:24Z")

</div>

Hi @Heryk,

Can you share your `docker-compose.yml` file (and potentially your `web_asset_store.xml` and any other files you might be mounting in Docker)?

The “connection refused” errors you are seeing are typically caused by misconfigured environment settings that control the communication between Specify 7 and the Web Asset Server.

As we work to resolve this, if you need to resume working in Specify without attachments, you can [comment out the lines](https://github.com/specify/docker-compositions/blob/c041ad5242b9dba4a0b66ce5bfc215d5deda2624/all-in-one/docker-compose.yml#L31-L32) related to the asset server under the Specify 7 service to stop the attempted connection.

---

<div class="post-metadata">

**Author:** ![wphillip](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/wphillip/32/3026_2.png) [@wphillip](https://speciforum.org/u/wphillip)\
**Post date:** [February 19, 2024, 5:24pm UTC](https://speciforum.org/t/new-bug-with-running-sp-7-on-docker/1535/3 "2024-02-19T17:24:56Z")

</div>

Your logs are trying to go to [http://0.0.0.0](http://0.0.0.0) but should be going to either an alias or 127.0.0.1 if running on the same instance.

Your composition file is very much needed to diagnose further

---

<div class="post-metadata">

**Author:** ![Heryk](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/heryk/32/5730_2.png) [@Heryk](https://speciforum.org/u/Heryk)\
**Post date:** [February 21, 2024, 9:15pm UTC](https://speciforum.org/t/new-bug-with-running-sp-7-on-docker/1535/4 "2024-02-21T21:15:34Z")

</div>

Hi,  
Checked and my IP has not changed and I’m using the same .env file as before.  
I don’t get why it stopped working.

My MariaDB is still accessible with DBeaver.  
But the portal continues to generate an nginx error message and I keep on getting the same nginx container log error message as pasted in my previous post.

![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/0/077a50387282914b1ee02bcf10a24a75c44e6a22.png)

Here is my docker-compose.yml

```auto
version: '3.7'
services:

  mariadb:
    restart: unless-stopped
    image: mariadb:10.11
    command: --max_allowed_packet=1073741824
    ports:
      - "${MYSQL_EXTERNAL_PORT}:3306"
    volumes:
# - "database:/var/lib/mysql" #- "/c/Users/hjulien/DockerMounts/mariadb-specify:/var/lib/mysql"
      - type: bind
        source: ${DB_VOLUME}
        target: /var/lib/mysql
      - "./seed-database:/docker-entrypoint-initdb.d"
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_DATABASE=${MYSQL_DATABASE}
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}

  specify7:
    restart: unless-stopped
    image: specifyconsortium/specify7-service:v7
    init: true
    volumes:
      - "specify6:/opt/Specify:ro"
      - "static-files:/volumes/static-files"
    environment:
      - DATABASE_HOST=mariadb
      - DATABASE_PORT=3306
      - DATABASE_NAME=${MYSQL_DATABASE}
      - MASTER_NAME=${MYSQL_USER}
      - MASTER_PASSWORD=${MYSQL_PASSWORD}
      - SECRET_KEY=${SPECIFY_SECRET_KEY}
      - ASSET_SERVER_URL=http://host.docker.internal:${SPECIFY_EXTERNAL_PORTAL_PORT}/web_asset_store.xml
      - ASSET_SERVER_KEY=${ASSET_SERVER_KEY}
      - REPORT_RUNNER_HOST=report-runner
      - REPORT_RUNNER_PORT=8080
      - CELERY_BROKER_URL=redis://redis/0
      - CELERY_RESULT_BACKEND=redis://redis/1
      - LOG_LEVEL=WARNING
      - SP7_DEBUG=false
    extra_hosts:
      - "host.docker.internal:host-gateway"

  specify7-worker:
    restart: unless-stopped
    image: specifyconsortium/specify7-service:v7
    command: ve/bin/celery -A specifyweb worker -l INFO --concurrency=1
    init: true
    volumes:
      - "specify6:/opt/Specify:ro"
      - "static-files:/volumes/static-files"
    environment:
      - DATABASE_HOST=mariadb
      - DATABASE_PORT=3306
      - DATABASE_NAME=${MYSQL_DATABASE}
      - MASTER_NAME=${MYSQL_USER}
      - MASTER_PASSWORD=${MYSQL_PASSWORD}
      - SECRET_KEY=${SPECIFY_SECRET_KEY}
      - ASSET_SERVER_URL=http://host.docker.internal:${SPECIFY_EXTERNAL_PORTAL_PORT}/web_asset_store.xml
      - ASSET_SERVER_KEY=${ASSET_SERVER_KEY}
      - REPORT_RUNNER_HOST=report-runner
      - REPORT_RUNNER_PORT=8080
      - CELERY_BROKER_URL=redis://redis/0
      - CELERY_RESULT_BACKEND=redis://redis/1
      - LOG_LEVEL=WARNING
      - SP7_DEBUG=false

  asset-server:
    restart: unless-stopped
    image: specifyconsortium/specify-asset-service
    init: true
    volumes:
# - "attachments:/home/specify/attachments" #- "/c/Users/hjulien/DockerMounts/attachments-specify:/home/specify/attachments"
      - type: bind
        source: ${ATTACHMENTS_VOLUME}
        target: /home/specify/attachments
    environment:
      - SERVER_NAME=${YOUR_IP_HERE}
      - SERVER_PORT=${SPECIFY_EXTERNAL_PORTAL_PORT}
      - ATTACHMENT_KEY=${ASSET_SERVER_KEY}
      - DEBUG_MODE=false

  specify6:
    image: specifyconsortium/specify6-service:6.8.02
    volumes:
      - "specify6:/volumes/Specify"

  nginx:
    restart: unless-stopped
    image: nginx
    ports:
      - "${SPECIFY_EXTERNAL_PORTAL_PORT}:80"
    volumes:
      - "static-files:/volumes/static-files:ro"
      - "specify6:/volumes/specify6:ro"
      - "./nginx/specify.conf:/etc/nginx/conf.d/default.conf:ro"

  report-runner:
    restart: unless-stopped
    image: specifyconsortium/report-runner

  redis:
    restart: unless-stopped
    image: redis:6.0

volumes:
  specify6: # provides Specify 6 files to Specify 7 and the web server
  static-files: # provides Specify 7 static files to the web server
# attachments: # the asset-servers attachment files
# database: # the data directory for mariadb

```

The nginx specify.conf file:

```auto
server {
    listen 80;
    server_name localhost;
    root /usr/share/nginx;

    # serve static files directly
    location /static/ {
        root /volumes;
        rewrite ^/static/config/(.*)$ /specify6/config/$1 break;
        rewrite ^/static/depository/(.*)$ /static-files/depository/$1 break;
        rewrite ^/static/(.*)$ /static-files/frontend-static/$1 break;
    }

    # proxy these urls to the asset server
    location ~ ^/(fileget|fileupload|filedelete|getmetadata|testkey|web_asset_store.xml) {
        client_max_body_size 0;
        resolver 127.0.0.11 valid=30s;
        set $backend "http://0.0.0.0:8080";
        proxy_pass $backend;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    # proxy everything else to specify 7
    location / {
        resolver 127.0.0.11 valid=30s;
        set $backend "http://0.0.0.0:8000";
        proxy_pass $backend;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

```

Could it be that one of the SP-7 images that I am using in my docker-compose has been modified/updated since last automne?

---

<div class="post-metadata">

**Author:** ![Heryk](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/heryk/32/5730_2.png) [@Heryk](https://speciforum.org/u/Heryk)\
**Post date:** [February 22, 2024, 1:46pm UTC](https://speciforum.org/t/new-bug-with-running-sp-7-on-docker/1535/5 "2024-02-22T13:46:29Z")

</div>

I got it to work again! I modified my $backend urls in the nginx specify.conf file to match the ones in this page and it worked: [docker-compositions/all-in-one/nginx/specify.conf at production · specify/docker-compositions (github.com)](https://github.com/specify/docker-compositions/blob/production/all-in-one/nginx/specify.conf)

Not sure why I had [http://0.0.0.0](http://0.0.0.0) in there in the first place and why it worked before. But now all seems to be back online.

Thanks @wphillip for your idea

Cheers  
Héryk

```auto
server {
    listen 80;
    server_name localhost;
    root /usr/share/nginx;

    # serve static files directly
    location /static/ {
        root /volumes;
        rewrite ^/static/config/(.*)$ /specify6/config/$1 break;
        rewrite ^/static/depository/(.*)$ /static-files/depository/$1 break;
        rewrite ^/static/(.*)$ /static-files/frontend-static/$1 break;
    }

    # proxy these urls to the asset server
    location ~ ^/(fileget|fileupload|filedelete|getmetadata|testkey|web_asset_store.xml) {
        client_max_body_size 0;
        resolver 127.0.0.11 valid=30s;
        #set $backend "http://0.0.0.0:8080";
        set $backend "http://asset-server:8080";
        proxy_pass $backend;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    # proxy everything else to specify 7
    location / {
        resolver 127.0.0.11 valid=30s;
        #set $backend "http://0.0.0.0:8000";
        set $backend "http://specify7:8000";
        proxy_pass $backend;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

```

---

<div class="post-metadata">

**Author:** ![vinayakjha](https://avatars.discourse-cdn.com/v4/letter/v/b9bd4f/32.png) [@vinayakjha](https://speciforum.org/u/vinayakjha)\
**Post date:** [February 26, 2024, 7:14pm UTC](https://speciforum.org/t/new-bug-with-running-sp-7-on-docker/1535/6 "2024-02-26T19:14:43Z")

</div>

> [@Heryk](#):
>
> Not sure why I had [http://0.0.0.0](http://0.0.0.0) in there in the first place and why it worked before.

Because 0.0.0.0:8080 was a solution specific for Podman!
