Unable to access site in docker-compose

  docker, docker-compose

I’ve been using: docker build -t devstack .

docker run --rm -p 443:443 -it -v ~/code:/code devstack

That has been working fine for me so far. I’ve been able to access the site as expected through my browser. I set my hosts file to point devstack.com to 127.0.0.1 and the site loads nicely. Now I’m trying to use docker-compose so I can use some of the functionality there to more easily connect with AWS.

services:
  web:
    build:
      context: .
    network_mode: "bridge"
    ports:
      - "443"
      - "80"
    volumes:
      - ~/code:/code
    image: devstack:latest 

So I run docker-compose build which gives me the familiar build stuff from Dockerfile.
Then I run docker-compose run web which puts me into the VM where I start apache (doing it manually at the moment), hit top to verify it’s running, then tail the log files. But when I attempt to hit the site in my browser, I get: devstack.com refused to connect. and no logs in the apache log files, so it’s not even getting to apache. So something about the ports isn’t opening up to me. Any idea what I need to change to make this work?

Edit: Updated file. Still same problem:

version: "3"
services:
  web:
    build:
      context: .
#    Same issue with both of these:
#    network_mode: "bridge"
#    network_mode: "host"
    ports:
      - "443:443"
      - "80:80"
    volumes:
      - ~/code:/code
    tty: true

Source: StackOverflow

LEAVE A COMMENT