Docker compose port forwarding not working properly

In my case, I was using docker-compose run without the --service-ports argument, so port mappings were ignored.

Example:

docker-compose.yml

version: "3"

services:
    app-host:
        image: nginx:1.19.0-alpine
        working_dir: /app
        volumes:
            - ./:/app/
        ports:
            - "80:3000"

command

    docker-compose run --service-ports app-host

References: discussion forum docker-compose documentation

Leave a Comment

tech