Local Symfony site hosted in container is unreachable

205 views Asked by At

I have the following setup for local development:

  • Symfony website in a Docker container
  • Using the symfony serve command in the container to serve the website
  • Port mapping "8083:8000" specified in the docker-compose.yaml
  • Using containerd container runtime with nerdctl compose up to run the Docker containers. These are on macOS Ventura using Rancher Desktop.

Expected behavior

Going to https://127.0.0.1:8083 or https://localhost:8083 in a browser while the Symfony site is being served in its container should serve the website hosted on the container's port 8000.

Actual behavior

ERR_CONNECTION_REFUSED from the browser -- the website refuses to connect.


Details

docker-compose.yaml (relevant parts):

version: '3'
services:
  php:
    container_name: nudgeforce-api
    build: .
    ports:
      - "8083:8000"
    command: php
    volumes:
      - .:/var/task

Dockerfile

FROM bref/php-82-fpm
RUN yum install -y git gzip zip unzip python3 tar
COPY --from=composer:2.4 /usr/bin/composer /usr/local/bin/composer
WORKDIR /var/task
# Symfony server
RUN curl -sS https://get.symfony.com/cli/installer | bash
RUN mv /root/.symfony5/bin/symfony /usr/local/bin/symfony \
    && symfony server:ca:install

symfony serve output

enter image description here

0

There are 0 answers