Cannot hot reload my ionic app integrated with Docker

  docker, ionic-framework, ubuntu

I have this Dockerfile

FROM node:15.11.0-alpine

#ENVIRONNEMENT
ENV GLIB_PACKAGE_BASE_URL https://github.com/sgerrand/alpine-pkg-glibc/releases/download
ENV GLIB_VERSION 2.25-r0

ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk

ENV GRADLE_HOME /usr/local/gradle
ENV GRADLE_VERSION 4.4

ENV ANDROID_HOME /usr/local/android-sdk-linux
ENV ANDRDOID_TOOLS_VERSION r25.2.5
ENV ANDROID_API_LEVELS android-26
ENV ANDROID_BUILD_TOOLS_VERSION 26.0.2
ENV IONIC_VERSION 5

ENV PATH ${GRADLE_HOME}/bin:${JAVA_HOME}/bin:${ANDROID_HOME}/tools:$ANDROID_HOME/platform-tools:$PATH

# INSTALL JAVA
RUN apk update ...

# INSTALL IONIC AND CORDOVA
RUN npm install -g cordova [email protected]${IONIC_VERSION}

#INSTALL Graddle
RUN mkdir -p ${GRADLE_HOME} ...

# INSTALL ANDROID
RUN mkdir -p ${ANDROID_HOME} ...

# INSTALL GLIBC
RUN curl -L ...

# CONFIGURATION
RUN echo y | android update sdk --no-ui -a --filter platform-tools,${ANDROID_API_LEVELS},build-tools-${ANDROID_BUILD_TOOLS_VERSION}

# Make license agreement
RUN mkdir $ANDROID_HOME/licenses ...


#FILES DELETION
RUN rm -rf /tmp/* /var/cache/apk/*

WORKDIR /usr/app
RUN npm install

COPY ./ /usr/app

I am building it with CMD:

docker build -t <image-name> .

I have this docker-compose.yml file:

version: '3.6'
services:
  app:
    container_name: karma5_ionic
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - '8100:8100'
      - '35729:35729'  
    command: ionic serve --external

I run the following command:

sudo docker-compose up -d

The application is displaying fine in the browser in localhost:8100

Problem:

When I make changes, there is no hot reload.

localhost:35729 might be temporarily down or it may have moved permanently to a new web address.

Or localhost:35729 the connections was reset

The only way that i can see changes is if I

run docker-compose build 
docker-compose up -d again

Source: Docker Questions

LEAVE A COMMENT