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

1 comment

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.

×
1 answer

This question was answered by @ioio:

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

View the original comment

Submit an Answer