Docker-compose on a server

Hello,

I’m trying to set up lizmap on a Debian server.
I would like to dockerize lizmap as well as other software that will allow to manage docker and my db (portainer, pgadmin, cloud cmd).
I made my docker-compose.yml file and when I launch it on my computer everything works as it should.
The problem is when I run docker-compose up --build on my Debian server, when I try to access one of the services via the web it doesn’t work.
I tried to go through localhost:<defined port> as well as <ip of the server>:<defined port> and it doesn’t work.
I’ve been going around in circles for several days and I can’t find the answer to my problem on google.
Here’s my docker-compose.yml file:

version: '3.1'
services:
  web:
    container_name: web
    image: httpd:2.4
    volumes:
      - ./php:/var/www/html
    ports:
      - "8080:80"
    depends_on:
      - postgis
    tty: true
    stdin_open: true

  lizmap:
    container_name: lizmap
    image: jancelin/docker-lizmap:3.2.2
    restart: always
    ports:
     - 3080:3080
     - 442:442
    volumes:
     - qgis:/home
     - var:/var/www/websig/lizmap/var
    depends_on:
      - postgis
      - qgis-server

  qgis-server:
    container_name: qgis-server
    image: jancelin/qgis-server:2.18LTR
    restart: always 
    environment:
      - QGIS_PROJECT_FILE=/data/osm.qgs
      - QGIS_SERVER_LOG_LEVEL=0
      - DEBUG=1 
    volumes:
      - qgis:/home

  postgis:
    container_name: postgis
    image: kartoza/postgis:14
    ports:
        - '5433:5433'
    environment:
      POSTGRES_USER: admin
      POSTGRES_PASSWORD: secret
    volumes:
        - postgis:/var/lib/postgresql

  pgadmin:
    container_name: pgadmin
    image: dpage/pgadmin4
    restart: always
    environment:
      PGADMIN_DEFAULT_EMAIL: admin@admin.com
      PGADMIN_DEFAULT_PASSWORD: secret
      PGADMIN_LISTEN_PORT: 5080
    ports:
      - "5080:5080"
    volumes:
     - pgadmin-data:/var/lib/pgadmin

  portainer:
    container_name: portainer
    image: portainer/portainer
    restart: always
    ports:
      - 9000:9000
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer:/data

  cloud:
    container_name: cloud
    image: coderaiser/cloudcmd:latest-alpine
    restart: always
    ports:
      - 8000:8000
    volumes:
      - qgis:/mnt/fs

volumes:
  pgadmin-data:
  php: 
  postgis:
  portainer:
  qgis:
  var:

And my server is under Debian 10 Buster
Thanks for reading and if anyone has a solution, i’ll be grateful.

Where did you try tried this? On the server or on your machine? I mean, localhost will work only from your server, obviously, so I suppose you tried there, but that should work fine. If you try with an IP address locally from the server, that should work too, if that service is listening on that IP address.

If you try an IP address from your machine, even if you forwarded ports to the containers, firewalls can prevent you to access those ports externally.

Does it happen with all of yous services?

PS.: Make sure you use the </> button to insert codes like xml tags. Your placeholders were removed by the forums filters. I fixed your post.

Hello,
I tried localhost: on my machine (when i docker-compose up on my machine) and it worked just fine, but when i try it on my server it doesn’t work (docker-compose up on my server). (I use Bitwise to access my server). Also when i try :, sometimes it works and i can access my web container (it’s just a string saying hello world), and i can access portainer, pgAdmin, cloud cmd and when i use the command pg_isready -h localhost -p 5432 i have the accepting connexion message. But sometimes it won’t work and i don’t know why. The container who seems to work each time is portainer. But the real problem is with Lizmap, in localhost from my machine it works but when i launch it on the server and try to access it, nothing.
And i’m sorry, i thought i user the </> button, thanks for fixing my post

No, you still don’t use that. Now I leave your message unedited so you can see that why we can’t see some parts of your message.

It could be a network issue on your server. For example bad routing. If portainer is always available and other containers not, then it could be a reverse proxy forwarding request randomly to a wrong container. I can happen when you have multiple container with the same name on the same custom Docker network in different Docker Compose projects. For example when you name a container “web” in project “mysite1” but you have an other container with the same name in project “mysite2”.

If you try to accesss the db on localhost that should always work unless your db is restarting or something like that