I have a web app that build markdown to react pages(docusaurus) I also have a python app to convert jupyter notebooks to markdown so that these can then also be converted to react pages.
I have now decided to containerize my solution and have run into a problem with port forwarding. When I start the container there aren't any errors but when I go to localhost:3000 which is where the react app should be I get an ERR_EMPTY_RESPONSE. Interestingly on other ports I get ERR_CONNECTION_REFUSED so something must be working with the port mapping. I am running it with a fresh install of docker on macOS Montery 12.4 with intel chip.
Dockerfile.frontend
FROM nikolaik/python-nodejs:python3.8-nodejs18
WORKDIR /app
EXPOSE 3000 8888
# Install python dependencies
COPY requirements.txt /app/
RUN pip3 install -r requirements.txt
RUN jupyter labextension install @jupyterlab/vega5-extension
# Install node dependencies
COPY package.json /app/
RUN npm install
# Build Markdown files from Jupyter Notebooks
COPY . /app/
RUN nbdoc_update && nbdoc_build
docker-compose.yml
version: '3.9'
services:
frontend:
command: 'npm run start'
build:
dockerfile: ./docker/Dockerfile.frontend
ports:
- '3000:3000'
- '8888:8888'
With sudo lsof -i -n -P | grep TCP
I was also able to find out that the ports are listening:
com.docke 2921 ... TCP *:3000 (LISTEN)
com.docke 2921 ... TCP *:8888 (LISTEN)