I am trying to update the gdal-bin package from Debian unstable in the following Dockerfile:

FROM postgis/postgis:15-master

RUN echo 'deb http://deb.debian.org/debian testing main' >> /etc/apt/sources.list \
  && apt-get -y update \
  && DEBIAN_FRONTEND=noninteractive \
     apt-get -y install \
       --fix-missing \
       --no-install-recommends gdal-bin \
  && apt-get -y autoremove --purge

but when it comes to apt-get autoremove, it messes up the locales stuff (which in turns crashes the database initialization when I want to spin up a container from this image):

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  libaom0* libdav1d4* libgeos-3.9.0* libx265-192*
0 upgraded, 0 newly installed, 4 to remove and 134 not upgraded.
After this operation, 24.3 MB disk space will be freed.
Do you want to continue? [Y/n] y
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_US.utf8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

What is wrong with that and how can I fix it?

Here are some useful links:

1 Answer 1


This warning (not error) means that en_US.UTF-8 hasn't been configured on the system and when a perl script is executed, perl warns about it.

Try adding this to the Dockerfile:

RUN /sbin/locale-gen

It'll generate the needed files for all the locales that are listed in /etc/locale.gen.

  • /bin/sh: 1: /sbin/locale-gen: not found on Debian based image. Also: # ls /sbin/l* /sbin/ldconfig /sbin/logsave /sbin/losetup. It's apparently under: /usr/sbin/locale-gen
    – s.k
    Dec 25, 2022 at 18:15
  • Ah yes. If you don't have usrmerge installed then /sbin/ and /usr/sbin/ are different on Debian. This will change when bookworm (next stable) is released.
    – V13
    Dec 26, 2022 at 22:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .