0

So, this is the first problem that I didn't find any answer around the internet.

So, basically I have a redbird app that works as expected and i decided to put it inside a Docker container (don't wanna run screen or tmux, etc).

So i created a Dockerfile as follow:

FROM node:alpine

WORKDIR /var/WebService/apps/redbird

COPY package*.json ./
RUN npm install

COPY . .

EXPOSE 80 443
CMD ["node", "app"]

and a docker-compose.yml as follow:

version: "3"

services:
    redbird:
        container_name: redbird
        build: .
        command: npm start
        ports:
            - "80"
            - "443"
        environment:
            NODE_ENV: PRODUCTION

and it doesn't work.

My thoughts are:

  • Docker does not have access to port 80 and 443. (yes, i'm running as root and i know it is not recommended).
  • Docker is not mapping the ports inside the container to my external LAN.

And, why people are not talking about redbird? i found 0 help about redbird.

  • In what way doesn’t it work? That form of `ports:` asks Docker to pick the host port; it avoids some potential conflicts but is harder to use. – David Maze Oct 16 '19 at 15:09
  • The request doesn't work. I access domain.com and it can't connect to the server. –  Oct 16 '19 at 15:42

1 Answers1

0

You don't need docker-compose to execute a docker container. You also have images of redbird at dockerhub such as https://hub.docker.com/r/myuserindocker/redbird-reverseproxy.

docker run --rm -p 80:80 -p 443:443 myuserindocker/redbird-reverseproxy
fifoq
  • 183
  • 13
  • Hey, i need to use this image that I'm creating, it's not the default redbird. Ane the problem is actually binding ports using docker because it works fine if i just run like npm start –  Oct 16 '19 at 22:20
  • It seems a format problem to me. I would recommend to build it in docker and after checking it take a look at the docker-compose file. This code should work: "docker build -t user/myimage:latest ." and "docker run --rm -p 80:80 -p 443:443 user/myimage:latest". Please if it's prompting an error, add it – fifoq Oct 17 '19 at 19:16
  • Also I don't know if docker binds the ports just saying "80" and not "80:80". If you're sure it's port binding try to use the complete argument. The other options in your file are fine. – fifoq Oct 17 '19 at 19:22