Problem: Different encoding in two equal docker containers

Viewed 37

Currently I have a very weird docker behavior and I really hope someone has an idea.

Here are some information about the setup:

  • My Dockerfile is based on php:7.4.27-apache-buster.
  • The container is build on two Kubernetes clusters (Staging and Productive).
  • The PHP application fetches data by a curl request two a third party system and tries to process this data and store it into a mariaDB database.
  • The mariaDB databases on staging and productive are equally setup.
  • The third party system responds with same data and encoding on both environments.

The weird behavior is, the staging container works as expected but the production container doesn't encode unicode characters properly.

Because both containers are build with the same Dockerfile, use the same application code, receive the same data and work with equally configured databases, I have no clue how this problem can be even possible. We also already tried to rebuild the container for both environments but nothing changed.

Did anybody experience something like that? Or has anybody any idea what the reason of this difference could be?

Application description: The PHP application runs on a cron job. Every 15 minutes, a request is sent to a third party system, which response with a dataset in json format. This data is decoded processed by the application. While processing, the application checks for data validity and removes invalid data from the set. As a last step, the data is stored in the database.

  • MariaDB version: 10.5.17
  • PHP version: 7.4.27
  • Docker version: 20.10.18
  • Kubernetes version: 1.20.6
  • Go version: 1.18.6

Dockerfile:

FROM php:7.4.27-apache-buster
RUN curl -sL https://deb.nodesource.com/setup_17.x | bash -
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
RUN apt-get remove -y libstdc++-8-dev && \
  wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
    apt-get install -y fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf && \
    apt-get install -y libx11-xcb1 libxtst6 libnss3 libxss1 libasound2 libatk-bridge2.0-0 libgtk-3-0 && \
    apt-get install -y xvfb
RUN apt-get install -y cron sendmail && \
  apt-get install -y libzip-dev && \
  apt-get install -y chromium && \
  apt-get autoremove -y && \
  rm -rf /var/lib/apt/lists/* && \
  rm -rf /var/cache/*
RUN docker-php-ext-install pdo pdo_mysql mysqli zip
RUN apt-get update -y && apt-get install -y zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev imagemagick && \
    docker-php-ext-configure gd --with-jpeg --with-freetype && \
    docker-php-ext-install gd
COPY container/policy.xml /etc/ImageMagick-6/policy.xml
RUN apt-get update -y && \
    apt-get install -y libmagickwand-dev && \
    pecl install imagick && \
    docker-php-ext-enable imagick
RUN groupadd -g 118 myapp
RUN useradd -d /myapp -G audio,video -g myapp -u 113 myapp
RUN chsh -s /bin/bash myapp
COPY --chown=myapp . .
COPY container/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod a+rx /usr/local/bin/entrypoint.sh
WORKDIR /app
EXPOSE 80
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
0 Answers
Related