skip to Main Content

There is this error and I tried to change my Dockerfile but nothing seems to work.

I’m currently on MacOS 14.3 and working with Docker for Desktop

Heres part of my file that’s probably causing problems:

FROM php:8.3-fpm

RUN apt-get update --fix-missing 
  && apt-get -y install libicu-dev libonig-dev libzip-dev gnupg 
  unzip locales libxml2-dev wget software-properties-common supervisor gcc make autoconf

RUN apt-get update && apt-get install -y lsb-release gnupg 
    && echo "deb [arch=amd64] https://packages.microsoft.com/debian/10/prod buster main" > /etc/apt/sources.list.d/mssql-release.list 
    && apt-get update 
    && apt-get install -y --no-install-recommends apt-transport-https

RUN gpg --keyserver keyserver.ubuntu.com --recv-key EB3E94ADBE1229CF 
    && gpg -a --export EB3E94ADBE1229CF | apt-key add - && apt-get update

RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft-prod.gpg] https://packages.microsoft.com/debian/10/prod buster main" > /etc/apt/sources.list.d/mssql-release.list 
    && apt-get update 
    && ACCEPT_EULA=Y apt-get install -y msodbcsql17

and there is error that keeps on poping up:

2.368 Get:4 https://packages.microsoft.com/debian/10/prod buster InRelease [6537 B]
2.419 Err:4 https://packages.microsoft.com/debian/10/prod buster InRelease
2.419   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
2.428 Reading package lists...
2.631 W: GPG error: https://packages.microsoft.com/debian/10/prod buster InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
2.631 E: The repository 'https://packages.microsoft.com/debian/10/prod buster InRelease' is not signed.
------
failed to solve: process "/bin/sh -c apt-get update && apt-get install -y lsb-release gnupg     && echo "deb [arch=amd64] https://packages.microsoft.com/debian/10/prod buster main" > /etc/apt/sources.list.d/mssql-release.list     && apt-get update     && apt-get install -y --no-install-recommends apt-transport-https" did not complete successfully: exit code: 100
`docker-compose` process finished with exit code 17

2

Answers


  1. Chosen as BEST ANSWER

    after a lot of research I finally found good solution that worked for me so I want to post how my file looks like after many iterations and it seems to be working for now!

    FROM php:8.3-fpm
    
    RUN apt-get update --fix-missing 
      && apt-get -y install libicu-dev libonig-dev libzip-dev gnupg 
      unzip locales libxml2-dev wget software-properties-common supervisor gcc `enter code here`make autoconf
        
    RUN apt-get update && apt-get install --no-install-recommends --yes gnupg2 libgssapi-krb5-2 unixodbc-dev
    
    RUN curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg 
    &&  curl https://packages.microsoft.com/config/debian/12/prod.list | tee /etc/apt/sources.list.d/mssql-release.list 
    &&  apt-get update
    
    RUN apt-get update && 
        apt-get install -y -q --allow-unauthenticated 
        git 
        sudo
    RUN useradd -m -s /bin/zsh linuxbrew && 
        usermod -aG sudo linuxbrew &&  
        mkdir -p /home/linuxbrew/.linuxbrew && 
        chown -R linuxbrew: /home/linuxbrew/.linuxbrew
    USER linuxbrew
    RUN CI=1 /bin/bash -c "$(sudo curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    USER root
    RUN chown -R $CONTAINER_USER: /home/linuxbrew/.linuxbrew
    ENV PATH="/home/linuxbrew/.linuxbrew/bin:${PATH}"
    RUN git config --global --add safe.directory /home/linuxbrew/.linuxbrew/Homebrew
    USER linuxbrew
    RUN /bin/bash -c "$(brew update)"
    RUN /bin/bash -c "$(brew doctor)"
    USER root
    RUN  /bin/bash -c "$(brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release)" 
    &&  /bin/bash -c "$(brew update)" 
    &&  /bin/bash -c "$(HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql17 mssql-tools)" 
    

  2. When creating new Dockerfiles I recommend using docker run to build out and test your installation steps, because many warnings and some errors are hidden away by the docker build and docker-compose tools.

    The way Debian manages package signing keys has changed over time. This old way of installing keys using apt-key no longer works:

    gpg --keyserver keyserver.ubuntu.com --recv-key EB3E94ADBE1229CF 
        && gpg -a --export EB3E94ADBE1229CF | apt-key add -
    

    Although updated from this, even Microsoft’s instructions at Install the Microsoft ODBC driver for SQL Server (Linux) are out of date and incorrect for Debian 12:

    curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
    

    For Debian 12 specifically this doesn’t work because the repo at https://packages.microsoft.com/config/debian/12/prod.list contains a reference to a specific local .gpg file:

    deb [arch=amd64,arm64,armhf signed-by=/usr/share/keyrings/microsoft-prod.gpg] https://packages.microsoft.com/debian/12/prod bookworm main
    

    To make this work you need the following command instead (thanks to Debian 12 public key is not available):

    curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg
    

    Testing with docker run -it -u 0 --rm php:8.3-fpm /bin/bash a complete recipe for Debian 12, based in Microsoft’s instructions but actually working, looks like the following:

    # Install prerequisites
    apt-get update && apt-get install --no-install-recommends --yes gnupg2 libgssapi-krb5-2 unixodbc-dev
    
    # Register Microsoft's repo for Debian 12
    curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg
    curl https://packages.microsoft.com/config/debian/12/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
    apt-get update
    
    # Install ODBC Driver 17 for SQL Server and tools (sqlcmd, etc.)
    ACCEPT_EULA=Y apt-get install --no-install-recommends --yes msodbcsql17 mssql-tools
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search