Question

How to make my docker-compose app work?

I tried to make my Django/Vue app work, but I can’t. Here’s the steps: I followed the tutorials to install docker, docker-compose. If I check ufw rules, it shows it allows traffic on port 80, the exct port I need. But if I am inside the droplet, do curl localhost, I get: curl: (7) Failed to connect to localhost port 80: Connection refused I run docker compse up I go to the browser, go to my http://my-droplets-ip, I get “This site can’t be reached” I try to run the kinematic hello world example, from docker hub, it works :-) Obviously, I am a newbie in Docker and first time on DO, but I really want to understand this stuff better. AT this point I am not sure the problem is with my docker-compose file or the firewall. (I doubt it’s the firewall since the kinematic example ran just fine) Here’s my docker-compose file:

version: '3.3'

volumes:
    postgres_data: {}

services:
  backend:
    build:
      context: ./backend
    depends_on:
      - postgres
    volumes:
      - ./backend:/app
    command: /start.sh
    entrypoint: /entrypoint.sh
    restart: on-failure
    env_file: .env

  frontend:
    image: node:10-alpine
    command: npm run serve
    volumes:
      - ./.env:/app/.env:ro
      - ./frontend:/app
    working_dir: /app
    restart: on-failure

  postgres:
    image: postgres:10-alpine
    volumes:
      - postgres_data:/var/lib/postgresql/data
    env_file: .env



  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
    depends_on:
      - backend
    volumes:
      - ./backend/media/:/media/
      - ./backend/staticfiles/:/staticfiles/
      - ./nginx/dev.conf:/etc/nginx/nginx.conf:ro
    logging:
      driver: none

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

This question was answered by @ioio:

Sorry, it works :-) It’s on the 8000 port…

View the original comment