Search code examples
mysqldockerdockerfileapt-get

Dockerfile running from Mysql cannot access apt-get


When I run docker-compose up to install our MySQL server, I get the following error:

RUN apt-get -y update && apt-get upgrade -y:
/bin/sh: apt-get: command not found

from the relevant dockerfile code:

FROM mysql:5.7

RUN apt-get -y update && apt-get upgrade -y

This used to work fine a few months ago for my coworkers.


Solution

  • Apparently since Oracle bought MySQL in 2010, they have been converting everything over to their proprietary OS. In the last few months, they switched the default mysql package to Oracle OS from Debian.

    See the packages here: https://hub.docker.com/_/mysql

    You now need to specify the debian package like:

    FROM mysql:5.7-debian
    
    RUN apt-get -y update && apt-get upgrade -y