Score:0

E: Unable to locate package unixODBC-dev

dk flag
E: Unable to locate package unixODBC-dev

ERROR: Service 'php' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y unixODBC-dev && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100

I am getting this even though I did an apt-get update. Is this normal?

This is my Dockerfile:

FROM george/php:7.4-fpm

RUN apt-get --allow-releaseinfo-change update
RUN apt-get update && apt-get install -y \
        freetds-bin \
        freetds-dev \
        freetds-common 


RUN apt-get update && apt-get install -y unixODBC-dev && rm -rf /var/lib/apt/lists/*
RUN set -x \
&& cd /usr/src/php/ext/odbc \
&& phpize \
&& sed -ri 's@^ *test +"\$PHP_.*" *= *"no" *&& *PHP_.*=yes *$@#&@g' configure \
&& ./configure --with-unixODBC=shared,/usr \
&& docker-php-ext-install odbc
 
RUN docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr
RUN docker-php-ext-configure pdo_dblib --with-libdir=/lib/x86_64-linux-gnu

RUN docker-php-ext-install pdo_odbc
RUN docker-php-ext-install pdo_dblib
RUN docker-php-ext-install pcntl
RUN docker-php-ext-enable pdo_odbc
RUN docker-php-ext-enable pdo_dblib
RUN docker-php-ext-enable pcntl

I am using a box based off Debian:

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Trying to understand why installing ODBC is so hard.

cn flag
I learned a lesson in a recent outage; I was installing packages from the alpine linux repo and the repo went down preventing my containers from restarting. If you install that much stuff into a container, you should really "docker commit" your changes from the container to a new image, and then "docker push" to push the new image to your repo. The way you're setup right now if either a debian repo or the docker-php-ext-install repo goes down you'll have restarting issues.
cn flag
i'm not sure why your repo doesn't have the required package, but I found a copy here: https://packages.debian.org/sid/amd64/unixodbc-dev/download
dk flag
what command should I run, and is there a fool proof way into installing all the packages I want?
cn flag
I'm not sure how to get the odbc driver working, I googled around and found some instructions on installing the MS odbc driver, but I don't ever use SQL server and can't comment from experience how to fix your problem. Google it, other people appear to have had that issue. As for how to setup everything, I'd take the dockerfile you're working on, run the container, and log in (docker exec -it containernumber bash). Then get it setup from inside the container, you can prob wget/curl packages if needed. Then "docker commit containername imagename". >>
cn flag
You'll then see the imagename when you run "docker image ls". From there you should probably have a private repo of some sort. Docker registry didn't look hard to setup, but your company probably has one already. Then you docker push to your local repo using the new syntax, like "docker push imagename reposerver:8081/foobar-api/imagename:latest" or something like that. There's documentation here: https://docs.docker.com/engine/reference/commandline/push/ Hope that's what you mean! Make sure you test the image you make to ensure that the main program for your container still starts correctly
cn flag
Once your packages and php setup and everything is baked into the image you should be set perminantly. The main problem with doing that (and why you might want to have the install in a dockerfile) is that it makes it difficult to automate creating docker containers. You can always go back and turn your installation steps, including committing the container to an image, into your container building/release routine.
cn flag
Anyway this is just random advice, feel free to ignore me :)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.